mirror of
https://github.com/wiiu-env/homebrew_launcher.git
synced 2024-11-24 13:49:18 +01:00
Merge pull request #5 from andriy921/master
Added firmware 4.0.0 support and fixed 4.1.0 and 5.0.0 sound issue
This commit is contained in:
commit
55e76f8cf7
@ -79,7 +79,13 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define BAT4U_VAL 0x008000FF
|
#define BAT4U_VAL 0x008000FF
|
||||||
#define BAT4L_VAL 0x30800012
|
#if VER >= 410
|
||||||
|
#define BAT4L_VAL 0x30800012
|
||||||
|
#elif VER == 400
|
||||||
|
#define BAT4L_VAL 0x4E800012
|
||||||
|
#else
|
||||||
|
#error Please define valid value for firmware setup.
|
||||||
|
#endif
|
||||||
|
|
||||||
#define SET_R4_TO_ADDR(addr) \
|
#define SET_R4_TO_ADDR(addr) \
|
||||||
lis r3, addr@h ; \
|
lis r3, addr@h ; \
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
#define KERN_SYSCALL_TBL_3 0xFFE85470 // works with loader
|
#define KERN_SYSCALL_TBL_3 0xFFE85470 // works with loader
|
||||||
#define KERN_SYSCALL_TBL_4 0xFFEAAA60 // works with home menu
|
#define KERN_SYSCALL_TBL_4 0xFFEAAA60 // works with home menu
|
||||||
#define KERN_SYSCALL_TBL_5 0xFFEAAE60 // works with browser (previously KERN_SYSCALL_TBL)
|
#define KERN_SYSCALL_TBL_5 0xFFEAAE60 // works with browser (previously KERN_SYSCALL_TBL)
|
||||||
#elif ( (VER == 400) || (VER == 410) )
|
#elif (VER == 410)
|
||||||
#define ADDRESS_OSTitle_main_entry_ptr 0x1005A8C0
|
#define ADDRESS_OSTitle_main_entry_ptr 0x1005A8C0
|
||||||
#define ADDRESS_main_entry_hook 0x0101BD4C
|
#define ADDRESS_main_entry_hook 0x0101BD4C
|
||||||
|
|
||||||
@ -50,8 +50,31 @@
|
|||||||
#define KERN_SYSCALL_TBL_3 0xFFE85C90
|
#define KERN_SYSCALL_TBL_3 0xFFE85C90
|
||||||
#define KERN_SYSCALL_TBL_4 0xFFE85490
|
#define KERN_SYSCALL_TBL_4 0xFFE85490
|
||||||
#define KERN_SYSCALL_TBL_5 0xFFE85890 // works with browser
|
#define KERN_SYSCALL_TBL_5 0xFFE85890 // works with browser
|
||||||
|
#elif (VER == 400)
|
||||||
|
#define ADDRESS_OSTitle_main_entry_ptr 0x1005A600
|
||||||
|
#define ADDRESS_main_entry_hook 0x0101BD4C
|
||||||
|
|
||||||
|
#define KERN_SYSCALL_TBL_1 0xFFE84C90
|
||||||
|
#define KERN_SYSCALL_TBL_2 0xFFE85090
|
||||||
|
#define KERN_SYSCALL_TBL_3 0xFFE85C90
|
||||||
|
#define KERN_SYSCALL_TBL_4 0xFFE85490
|
||||||
|
#define KERN_SYSCALL_TBL_5 0xFFE85890 // works with browser
|
||||||
|
#else
|
||||||
|
#error Please define valid values for firmware.
|
||||||
#endif // VER
|
#endif // VER
|
||||||
|
|
||||||
|
#define ROOTRPX_DBAT0U_VAL 0xC00003FF
|
||||||
|
#define COREINIT_DBAT0U_VAL 0xC20001FF
|
||||||
|
#if (VER >= 410)
|
||||||
|
#define ROOTRPX_DBAT0L_VAL 0x30000012
|
||||||
|
#define COREINIT_DBAT0L_VAL 0x32000012
|
||||||
|
#elif (VER == 400)
|
||||||
|
#define ROOTRPX_DBAT0L_VAL 0x4E000012
|
||||||
|
#define COREINIT_DBAT0L_VAL 0x4D000012
|
||||||
|
#else
|
||||||
|
#error Please define valid values for firmware.
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Install functions */
|
/* Install functions */
|
||||||
static void InstallMain(private_data_t *private_data);
|
static void InstallMain(private_data_t *private_data);
|
||||||
static void InstallPatches(private_data_t *private_data);
|
static void InstallPatches(private_data_t *private_data);
|
||||||
@ -283,12 +306,23 @@ static void KernelCopyData(unsigned int addr, unsigned int src, unsigned int len
|
|||||||
/*
|
/*
|
||||||
* Setup a DBAT access for our 0xC0800000 area and our 0xBC000000 area which hold our variables like GAME_LAUNCHED and our BSS/rodata section
|
* Setup a DBAT access for our 0xC0800000 area and our 0xBC000000 area which hold our variables like GAME_LAUNCHED and our BSS/rodata section
|
||||||
*/
|
*/
|
||||||
register int dbatu0, dbatl0;
|
register unsigned int dbatu0, dbatl0, target_dbat0u, target_dbat0l;
|
||||||
|
// setup mapping based on target address
|
||||||
|
if ((addr >= 0xC0000000) && (addr < 0xC2000000)) // root.rpx address
|
||||||
|
{
|
||||||
|
target_dbat0u = ROOTRPX_DBAT0U_VAL;
|
||||||
|
target_dbat0l = ROOTRPX_DBAT0L_VAL;
|
||||||
|
}
|
||||||
|
else if ((addr >= 0xC2000000) && (addr < 0xC3000000))
|
||||||
|
{
|
||||||
|
target_dbat0u = COREINIT_DBAT0U_VAL;
|
||||||
|
target_dbat0l = COREINIT_DBAT0L_VAL;
|
||||||
|
}
|
||||||
// save the original DBAT value
|
// save the original DBAT value
|
||||||
asm volatile("mfdbatu %0, 0" : "=r" (dbatu0));
|
asm volatile("mfdbatu %0, 0" : "=r" (dbatu0));
|
||||||
asm volatile("mfdbatl %0, 0" : "=r" (dbatl0));
|
asm volatile("mfdbatl %0, 0" : "=r" (dbatl0));
|
||||||
asm volatile("mtdbatu 0, %0" : : "r" (0xC0001FFF));
|
asm volatile("mtdbatu 0, %0" : : "r" (target_dbat0u));
|
||||||
asm volatile("mtdbatl 0, %0" : : "r" (0x30000012));
|
asm volatile("mtdbatl 0, %0" : : "r" (target_dbat0l));
|
||||||
asm volatile("eieio; isync");
|
asm volatile("eieio; isync");
|
||||||
|
|
||||||
unsigned char *src_p = (unsigned char*)src;
|
unsigned char *src_p = (unsigned char*)src;
|
||||||
|
@ -72,3 +72,23 @@ void InitAXFunctionPointers(void)
|
|||||||
OS_FIND_EXPORT(sound_handle, AXSetVoiceLoopOffset);
|
OS_FIND_EXPORT(sound_handle, AXSetVoiceLoopOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
@ -31,6 +31,7 @@ extern "C" {
|
|||||||
#include <gctypes.h>
|
#include <gctypes.h>
|
||||||
|
|
||||||
void InitAXFunctionPointers(void);
|
void InitAXFunctionPointers(void);
|
||||||
|
void ProperlyEndTransitionAudio(void);
|
||||||
|
|
||||||
extern void (* AXInitWithParams)(u32 * params);
|
extern void (* AXInitWithParams)(u32 * params);
|
||||||
extern void (* AXQuit)(void);
|
extern void (* AXQuit)(void);
|
||||||
|
@ -216,14 +216,23 @@ SoundDecoder * SoundHandler::GetSoundDecoder(const u8 * sound, int length)
|
|||||||
|
|
||||||
void SoundHandler::executeThread()
|
void SoundHandler::executeThread()
|
||||||
{
|
{
|
||||||
|
// v2 sound lib can not properly end transition audio on old firmwares
|
||||||
|
if (OS_FIRMWARE <= 410)
|
||||||
|
{
|
||||||
|
ProperlyEndTransitionAudio();
|
||||||
|
}
|
||||||
|
|
||||||
//! initialize 48 kHz renderer
|
//! initialize 48 kHz renderer
|
||||||
u32 params[3] = { 1, 0, 0 };
|
u32 params[3] = { 1, 0, 0 };
|
||||||
AXInitWithParams(params);
|
AXInitWithParams(params);
|
||||||
|
|
||||||
|
|
||||||
|
// The problem with last voice on 500 was caused by it having priority 0
|
||||||
|
// We would need to change this priority distribution if for some reason
|
||||||
|
// we would need MAX_DECODERS > Voice::PRIO_MAX
|
||||||
for(u32 i = 0; i < MAX_DECODERS; ++i)
|
for(u32 i = 0; i < MAX_DECODERS; ++i)
|
||||||
{
|
{
|
||||||
int priority = (MAX_DECODERS - 1 - i) * (Voice::PRIO_MAX - Voice::PRIO_MIN) / (MAX_DECODERS - 1);
|
int priority = (MAX_DECODERS - i) * Voice::PRIO_MAX / MAX_DECODERS;
|
||||||
voiceList[i] = new Voice(priority); // allocate voice 0 with highest priority
|
voiceList[i] = new Voice(priority); // allocate voice 0 with highest priority
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,15 +266,7 @@ void SoundHandler::executeThread()
|
|||||||
AXRegisterFrameCallback(NULL);
|
AXRegisterFrameCallback(NULL);
|
||||||
AXQuit();
|
AXQuit();
|
||||||
|
|
||||||
// deleting the last voice from the decoder produced DSI errors on 5.0.0 so we skip it
|
for(u32 i = 0; i < MAX_DECODERS; ++i)
|
||||||
// expecting same behaviour on every FW below 532
|
|
||||||
u32 delete_skip = 0;
|
|
||||||
if(OS_FIRMWARE < 532)
|
|
||||||
{
|
|
||||||
delete_skip = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(u32 i = 0; i < MAX_DECODERS - delete_skip; ++i)
|
|
||||||
{
|
{
|
||||||
delete voiceList[i];
|
delete voiceList[i];
|
||||||
voiceList[i] = NULL;
|
voiceList[i] = NULL;
|
||||||
|
@ -26,7 +26,7 @@ public:
|
|||||||
|
|
||||||
enum VoicePriorities
|
enum VoicePriorities
|
||||||
{
|
{
|
||||||
PRIO_MIN = 0,
|
PRIO_MIN = 1,
|
||||||
PRIO_MAX = 31
|
PRIO_MAX = 31
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user