diff --git a/Makefile b/Makefile index 1cea3a7..0f9918e 100644 --- a/Makefile +++ b/Makefile @@ -71,7 +71,7 @@ MAKEFLAGS += --no-print-directory #--------------------------------------------------------------------------------- # any extra libraries we wish to link with the project #--------------------------------------------------------------------------------- -LIBS := -lgcc -lgd -lpng -lz -lfreetype -lvorbisidec +LIBS := -lgcc -lgd -lpng -lz -lfreetype -lmad -lvorbisidec #--------------------------------------------------------------------------------- # list of directories containing libraries, this must be the top level containing diff --git a/installer/Makefile b/installer/Makefile index 4d04c96..297eb00 100644 --- a/installer/Makefile +++ b/installer/Makefile @@ -16,7 +16,7 @@ sd_loader_elf := ../sd_loader/sd_loader.elf CFLAGS += -DUSE_SD_LOADER ASFLAGS += -DUSE_SD_LOADER -all: clean setup main532 main550 main500 main410 main400 +all: clean setup main532 main550 main500 main410 main400 main310 main300 sd_loader.h: $(sd_loader_elf) xxd -i $< | sed "s/unsigned/static const unsigned/g;s/loader/loader/g;s/build_//g" > $@ diff --git a/installer/kernel_patches.S b/installer/kernel_patches.S index 35e45f6..a99b6e8 100644 --- a/installer/kernel_patches.S +++ b/installer/kernel_patches.S @@ -68,6 +68,32 @@ #define BAT_SET_NOP_ADDR_8 0xFFEE0F50 #define BAT_SET_NOP_ADDR_9 0xFFEE0F54 +#elif (VER == 310) + #define BAT_SETUP_HOOK_ADDR 0xFFF19EC4 + + #define BAT_SET_NOP_ADDR_1 0xFFF06590 + #define BAT_SET_NOP_ADDR_2 0xFFF0661C + #define BAT_SET_NOP_ADDR_3 0xFFF003C8 + #define BAT_SET_NOP_ADDR_4 0xFFF003CC + #define BAT_SET_NOP_ADDR_5 0xFFF19FAC + #define BAT_SET_NOP_ADDR_6 0xFFF19FC8 +// #define BAT_SET_NOP_ADDR_7 not present in 3.1.0 + + #define BAT_SET_NOP_ADDR_8 0xFFEE0FB0 + #define BAT_SET_NOP_ADDR_9 0xFFEE0FB4 +#elif (VER == 300) + #define BAT_SETUP_HOOK_ADDR 0xFFF19E2C + + #define BAT_SET_NOP_ADDR_1 0xFFF06590 + #define BAT_SET_NOP_ADDR_2 0xFFF0661C + #define BAT_SET_NOP_ADDR_3 0xFFF003C8 + #define BAT_SET_NOP_ADDR_4 0xFFF003CC + #define BAT_SET_NOP_ADDR_5 0xFFF19F14 + #define BAT_SET_NOP_ADDR_6 0xFFF19F30 +// #define BAT_SET_NOP_ADDR_7 not present in 3.0.x + + #define BAT_SET_NOP_ADDR_8 0xFFEE0DB8 + #define BAT_SET_NOP_ADDR_9 0xFFEE0DBC #else #error Please define valid values for kernel setup. #endif @@ -81,7 +107,7 @@ #define BAT4U_VAL 0x008000FF #if VER >= 410 #define BAT4L_VAL 0x30800012 -#elif VER == 400 +#elif VER <= 400 #define BAT4L_VAL 0x4E800012 #else #error Please define valid value for firmware setup. diff --git a/installer/launcher.c b/installer/launcher.c index fde85d8..0e2af07 100644 --- a/installer/launcher.c +++ b/installer/launcher.c @@ -59,6 +59,15 @@ #define KERN_SYSCALL_TBL_3 0xFFE85C90 #define KERN_SYSCALL_TBL_4 0xFFE85490 #define KERN_SYSCALL_TBL_5 0xFFE85890 // works with browser +#elif ( (VER == 300) || (VER == 310) ) + #define ADDRESS_OSTitle_main_entry_ptr 0x1005BBC0 + #define ADDRESS_main_entry_hook 0x0101894C // used OSDynLoad_Acquire 0x01022CBC from libwiiu to calculate + + #define KERN_SYSCALL_TBL_1 0xFFE84D50 + #define KERN_SYSCALL_TBL_2 0xFFE85150 + #define KERN_SYSCALL_TBL_3 0xFFE85D50 // comes after KERN_SYSCALL_TBL_5 + #define KERN_SYSCALL_TBL_4 0xFFE85550 + #define KERN_SYSCALL_TBL_5 0xFFE85950 #else #error Please define valid values for firmware. #endif // VER @@ -68,7 +77,7 @@ #if (VER >= 410) #define ROOTRPX_DBAT0L_VAL 0x30000012 #define COREINIT_DBAT0L_VAL 0x32000012 -#elif (VER == 400) +#elif (VER <= 400) #define ROOTRPX_DBAT0L_VAL 0x4E000012 #define COREINIT_DBAT0L_VAL 0x4D000012 #else diff --git a/src/dynamic_libs/ax_functions.c b/src/dynamic_libs/ax_functions.c index 97db459..fc1c571 100644 --- a/src/dynamic_libs/ax_functions.c +++ b/src/dynamic_libs/ax_functions.c @@ -21,10 +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" 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,13 +49,27 @@ EXPORT_DECL(void, AXSetVoiceLoopOffset, void *v, u32 offset); void InitAXFunctionPointers(void) { + unsigned int sound_handle = 0; unsigned int *funcPointer = 0; - unsigned int sound_handle; - 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); @@ -77,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(); } -} \ No newline at end of file +} diff --git a/src/dynamic_libs/ax_functions.h b/src/dynamic_libs/ax_functions.h index 8fe8df5..b7df998 100644 --- a/src/dynamic_libs/ax_functions.h +++ b/src/dynamic_libs/ax_functions.h @@ -34,6 +34,7 @@ void InitAXFunctionPointers(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); diff --git a/src/sounds/SoundHandler.cpp b/src/sounds/SoundHandler.cpp index 93ce942..68f9dd5 100644 --- a/src/sounds/SoundHandler.cpp +++ b/src/sounds/SoundHandler.cpp @@ -172,11 +172,11 @@ SoundDecoder * SoundHandler::GetSoundDecoder(const char * filepath) } else if(magic == 0x52494646) // 'RIFF' { - //return new WavDecoder(filepath); + return new WavDecoder(filepath); } else if(CheckMP3Signature((u8 *) &magic) == true) { - //return new Mp3Decoder(filepath); + return new Mp3Decoder(filepath); } return new SoundDecoder(filepath); @@ -204,11 +204,11 @@ SoundDecoder * SoundHandler::GetSoundDecoder(const u8 * sound, int length) } else if(magic[0] == 0x52494646) // 'RIFF' { - //return new WavDecoder(sound, length); + return new WavDecoder(sound, length); } else if(CheckMP3Signature(check) == true) { - //return new Mp3Decoder(sound, length); + return new Mp3Decoder(sound, length); } return new SoundDecoder(sound, length); @@ -217,15 +217,18 @@ SoundDecoder * SoundHandler::GetSoundDecoder(const u8 * sound, int length) void SoundHandler::executeThread() { // v2 sound lib can not properly end transition audio on old firmwares - if (OS_FIRMWARE <= 410) + if (OS_FIRMWARE >= 400 && OS_FIRMWARE <= 410) { ProperlyEndTransitionAudio(); } - + //! initialize 48 kHz renderer u32 params[3] = { 1, 0, 0 }; - AXInitWithParams(params); + if(AXInitWithParams != 0) + AXInitWithParams(params); + else + AXInit(); // 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 diff --git a/src/sounds/Voice.h b/src/sounds/Voice.h index 720ebc2..63fd94e 100644 --- a/src/sounds/Voice.h +++ b/src/sounds/Voice.h @@ -86,7 +86,9 @@ public: voiceBuffer.loop_offset = ((nextBuffer - buffer) >> 1); nextBufferSize = nextBufSize; - ratioBits[0] = (u32)(0x00010000 * ((f32)sampleRate / (f32)AXGetInputSamplesPerSec())); + u32 samplesPerSec = (AXGetInputSamplesPerSec != 0) ? AXGetInputSamplesPerSec() : 32000; + + ratioBits[0] = (u32)(0x00010000 * ((f32)sampleRate / (f32)samplesPerSec)); ratioBits[1] = 0; ratioBits[2] = 0; ratioBits[3] = 0; diff --git a/www/homebrew_launcher/payload300.html b/www/homebrew_launcher/payload300.html new file mode 100644 index 0000000..f630ea6 --- /dev/null +++ b/www/homebrew_launcher/payload300.html @@ -0,0 +1,580 @@ + +
+ + + + + + diff --git a/www/homebrew_launcher/payload310.html b/www/homebrew_launcher/payload310.html new file mode 100644 index 0000000..c6b45eb --- /dev/null +++ b/www/homebrew_launcher/payload310.html @@ -0,0 +1,580 @@ + + + + + + + +