mirror of https://github.com/zeldaret/tp
d_a_movie_player OK (#2958)
* Match THPAudioDecode * Match daMP_MixAudio * Fix weak func order * Fix global.h
This commit is contained in:
parent
d4859f8595
commit
497aa20aa9
|
|
@ -2155,7 +2155,7 @@ config.libs = [
|
|||
ActorRel(MatchingFor(ALL_GCN), "d_a_mant"),
|
||||
ActorRel(MatchingFor(ALL_GCN), "d_a_mg_fshop"),
|
||||
ActorRel(MatchingFor(ALL_GCN), "d_a_mirror"),
|
||||
ActorRel(NonMatching, "d_a_movie_player"),
|
||||
ActorRel(MatchingFor(ALL_GCN), "d_a_movie_player"),
|
||||
ActorRel(MatchingFor(ALL_GCN), "d_a_myna"),
|
||||
ActorRel(MatchingFor(ALL_GCN), "d_a_ni"),
|
||||
ActorRel(MatchingFor(ALL_GCN), "d_a_npc_aru"),
|
||||
|
|
|
|||
|
|
@ -69,7 +69,6 @@ public:
|
|||
int daMP_c_Finish();
|
||||
int daMP_c_Main();
|
||||
int daMP_c_Draw();
|
||||
daMP_c() {}
|
||||
|
||||
static int daMP_c_Callback_Init(fopAc_ac_c*);
|
||||
static int daMP_c_Callback_Finish(daMP_c*);
|
||||
|
|
@ -96,10 +95,6 @@ public:
|
|||
virtual void draw();
|
||||
};
|
||||
|
||||
inline s32 daMP_NEXT_READ_SIZE(daMP_THPReadBuffer* readBuf) {
|
||||
return *(s32*)readBuf->ptr;
|
||||
}
|
||||
|
||||
void daMP_PrepareReady(int);
|
||||
|
||||
#endif /* D_A_MOVIE_PLAYER_H */
|
||||
|
|
|
|||
|
|
@ -63,23 +63,13 @@
|
|||
#define STATIC_ASSERT(...)
|
||||
#endif
|
||||
|
||||
#ifdef __MWERKS__
|
||||
// Intrinsics
|
||||
#ifndef __MWERKS__
|
||||
// Silence clangd errors about MWCC PPC intrinsics by declaring them here.
|
||||
extern int __cntlzw(unsigned int);
|
||||
extern int __rlwimi(int, int, int, int, int);
|
||||
extern void __dcbz(void*, int);
|
||||
extern void __sync();
|
||||
extern int __abs(int);
|
||||
#else
|
||||
// to stop clangd errors
|
||||
#define __cntlzw
|
||||
#define __rlwimi
|
||||
#define __dcbz
|
||||
#define __sync
|
||||
#define __abs
|
||||
#endif
|
||||
|
||||
#ifndef __MWERKS__
|
||||
void* __memcpy(void*, const void*, int);
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -21,11 +21,14 @@
|
|||
#include "Z2AudioLib/Z2Instances.h"
|
||||
#include "f_op/f_op_overlap_mng.h"
|
||||
|
||||
inline s32 daMP_NEXT_READ_SIZE(daMP_THPReadBuffer* readBuf) {
|
||||
return *(s32*)readBuf->ptr;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// NONMATCHING
|
||||
static u32 THPAudioDecode(s16* audioBuffer, u8* audioFrame, s32 flag) {
|
||||
THPAudioRecordHeader* header;
|
||||
THPAudioDecodeInfo decInfo;
|
||||
|
|
@ -68,12 +71,12 @@ static u32 THPAudioDecode(s16* audioBuffer, u8* audioFrame, s32 flag) {
|
|||
yn += (sample << decInfo.scale) << 11;
|
||||
yn <<= 5;
|
||||
|
||||
if ((u16)(yn & 0xffff) > 0x8000) {
|
||||
yn += 0x10000;
|
||||
} else if ((u16)(yn & 0xffff) == 0x8000) {
|
||||
if ((yn & 0x10000))
|
||||
yn += 0x10000;
|
||||
}
|
||||
u16 temp = yn & 0xffff;
|
||||
if (temp > 0x8000) {
|
||||
yn += 0x10000;
|
||||
} else if (temp == 0x8000 && (yn & 0x10000)) {
|
||||
yn += 0x10000;
|
||||
}
|
||||
|
||||
if (yn > 2147483647LL) {
|
||||
yn = 2147483647LL;
|
||||
|
|
@ -103,14 +106,12 @@ static u32 THPAudioDecode(s16* audioBuffer, u8* audioFrame, s32 flag) {
|
|||
yn += (sample << decInfo.scale) << 11;
|
||||
yn <<= 5;
|
||||
|
||||
if ((u16)(yn & 0xffff) > 0x8000) {
|
||||
yn += 0x10000;
|
||||
} else {
|
||||
if ((u16)(yn & 0xffff) == 0x8000) {
|
||||
if ((yn & 0x10000))
|
||||
yn += 0x10000;
|
||||
}
|
||||
}
|
||||
u16 temp = yn & 0xffff;
|
||||
if (temp > 0x8000) {
|
||||
yn += 0x10000;
|
||||
} else if (temp == 0x8000 && (yn & 0x10000)) {
|
||||
yn += 0x10000;
|
||||
}
|
||||
|
||||
if (yn > 2147483647LL) {
|
||||
yn = 2147483647LL;
|
||||
|
|
@ -138,14 +139,12 @@ static u32 THPAudioDecode(s16* audioBuffer, u8* audioFrame, s32 flag) {
|
|||
yn += (sample << decInfo.scale) << 11;
|
||||
yn <<= 5;
|
||||
|
||||
if ((u16)(yn & 0xffff) > 0x8000) {
|
||||
yn += 0x10000;
|
||||
} else {
|
||||
if ((u16)(yn & 0xffff) == 0x8000) {
|
||||
if ((yn & 0x10000))
|
||||
yn += 0x10000;
|
||||
}
|
||||
}
|
||||
u16 temp = yn & 0xffff;
|
||||
if (temp > 0x8000) {
|
||||
yn += 0x10000;
|
||||
} else if (temp == 0x8000 && (yn & 0x10000)) {
|
||||
yn += 0x10000;
|
||||
}
|
||||
|
||||
if (yn > 2147483647LL) {
|
||||
yn = 2147483647LL;
|
||||
|
|
@ -3202,7 +3201,6 @@ static u16 daMP_VolumeTable[] = {
|
|||
0x7247, 0x7430, 0x761E, 0x7810, 0x7A06, 0x7C00, 0x7DFE, 0x8000,
|
||||
};
|
||||
|
||||
// NONMATCHING - missing extsh
|
||||
#pragma push
|
||||
#pragma optimization_level 3
|
||||
static void daMP_MixAudio(s16* destination, s16*, u32 sample) {
|
||||
|
|
@ -3218,6 +3216,7 @@ static void daMP_MixAudio(s16* destination, s16*, u32 sample) {
|
|||
requestSample = sample;
|
||||
dst = destination;
|
||||
|
||||
BOOL loop = TRUE;
|
||||
do {
|
||||
do {
|
||||
if (daMP_ActivePlayer.playAudioBuffer == (THPAudioBuffer*)NULL) {
|
||||
|
|
@ -3260,6 +3259,8 @@ static void daMP_MixAudio(s16* destination, s16*, u32 sample) {
|
|||
|
||||
if (JASDriver::getOutputMode() == 0) {
|
||||
l_mix = r_mix = ((r_mix >> 1) + (l_mix >> 1));
|
||||
r_mix = (s16)r_mix;
|
||||
l_mix = (s16)l_mix;
|
||||
}
|
||||
|
||||
dst[0] = l_mix;
|
||||
|
|
@ -3282,7 +3283,7 @@ static void daMP_MixAudio(s16* destination, s16*, u32 sample) {
|
|||
break;
|
||||
}
|
||||
|
||||
} while (TRUE);
|
||||
} while (loop);
|
||||
} else {
|
||||
memset(destination, 0, sample * 4);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue