mirror of
https://github.com/neoStudiosLCE/neoLegacy.git
synced 2026-08-19 21:47:13 +00:00
fix: handled all audio and parameter types correctly to prevent crashes
Original commit: 8658049e71
This commit is contained in:
parent
459bc20a77
commit
76ac11bde0
|
|
@ -139,6 +139,12 @@ const char *SoundEngine::m_szStreamFileA[eStream_Max]=
|
||||||
// The End
|
// The End
|
||||||
"the_end_dragon_alive",
|
"the_end_dragon_alive",
|
||||||
"the_end_end",
|
"the_end_end",
|
||||||
|
|
||||||
|
// Battle
|
||||||
|
"BattleMode1",
|
||||||
|
"BattleMode2",
|
||||||
|
"BattleMode3",
|
||||||
|
"BattleMode4",
|
||||||
|
|
||||||
// CDs
|
// CDs
|
||||||
"11",
|
"11",
|
||||||
|
|
@ -189,7 +195,7 @@ void SoundEngine::init(Options* pOptions)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoundEngine::SetStreamingSounds(int iOverworldMin, int iOverWorldMax, int iNetherMin, int iNetherMax, int iEndMin, int iEndMax, int iCD1)
|
void SoundEngine::SetStreamingSounds(int iOverworldMin, int iOverWorldMax, int iNetherMin, int iNetherMax, int iEndMin, int iEndMax, int iCreativeMin, int iCreativeMax, int iMenuMin, int iMenuMax, int iBattleMin, int iBattleMax, int iCD1)
|
||||||
{
|
{
|
||||||
m_iStream_Overworld_Min=iOverworldMin;
|
m_iStream_Overworld_Min=iOverworldMin;
|
||||||
m_iStream_Overworld_Max=iOverWorldMax;
|
m_iStream_Overworld_Max=iOverWorldMax;
|
||||||
|
|
@ -197,6 +203,12 @@ void SoundEngine::SetStreamingSounds(int iOverworldMin, int iOverWorldMax, int i
|
||||||
m_iStream_Nether_Max=iNetherMax;
|
m_iStream_Nether_Max=iNetherMax;
|
||||||
m_iStream_End_Min=iEndMin;
|
m_iStream_End_Min=iEndMin;
|
||||||
m_iStream_End_Max=iEndMax;
|
m_iStream_End_Max=iEndMax;
|
||||||
|
m_iStream_Creative_Min = iCreativeMin;
|
||||||
|
m_iStream_Creative_Max = iCreativeMax;
|
||||||
|
m_iStream_Menu_Min = iMenuMin;
|
||||||
|
m_iStream_Menu_Max = iMenuMax;
|
||||||
|
m_iStream_Battle_Min = iBattleMin;
|
||||||
|
m_iStream_Battle_Max = iBattleMax;
|
||||||
m_iStream_CD_1=iCD1;
|
m_iStream_CD_1=iCD1;
|
||||||
|
|
||||||
// array to monitor recently played tracks
|
// array to monitor recently played tracks
|
||||||
|
|
@ -402,12 +414,15 @@ SoundEngine::SoundEngine()
|
||||||
m_bHeardTrackA=nullptr;
|
m_bHeardTrackA=nullptr;
|
||||||
|
|
||||||
// Start the streaming music playing some music from the overworld
|
// Start the streaming music playing some music from the overworld
|
||||||
SetStreamingSounds(eStream_Overworld_Calm1,eStream_Overworld_piano3,
|
SetStreamingSounds(eStream_Overworld_Calm1, eStream_Overworld_piano3,
|
||||||
eStream_Nether1,eStream_Nether4,
|
eStream_Nether1, eStream_Nether4,
|
||||||
eStream_end_dragon,eStream_end_end,
|
eStream_end_dragon, eStream_end_end,
|
||||||
eStream_CD_1);
|
eStream_Overworld_Creative1, eStream_Overworld_Creative6,
|
||||||
|
eStream_Overworld_Menu1, eStream_Overworld_Menu4,
|
||||||
|
eStream_BattleMode1, eStream_BattleMode4,
|
||||||
|
eStream_CD_1);
|
||||||
|
|
||||||
m_musicID=getMusicID(LevelData::DIMENSION_OVERWORLD);
|
m_musicID = getMusicID(eMusicDomain_Menu);
|
||||||
|
|
||||||
m_StreamingAudioInfo.bIs3D=false;
|
m_StreamingAudioInfo.bIs3D=false;
|
||||||
m_StreamingAudioInfo.x=0;
|
m_StreamingAudioInfo.x=0;
|
||||||
|
|
@ -661,81 +676,83 @@ void SoundEngine::playUI(int iSound, float volume, float pitch)
|
||||||
// playStreaming
|
// playStreaming
|
||||||
//
|
//
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
void SoundEngine::playStreaming(const wstring& name, float x, float y , float z, float volume, float pitch, bool bMusicDelay)
|
void SoundEngine::playStreaming(const wstring& name, float x, float y, float z, float volume, float pitch, bool bMusicDelay)
|
||||||
{
|
{
|
||||||
// This function doesn't actually play a streaming sound, just sets states and an id for the music tick to play it
|
// This function doesn't actually play a streaming sound, just sets states and an id for the music tick to play it
|
||||||
// Level audio will be played when a play with an empty name comes in
|
// Level audio will be played when a play with an empty name comes in
|
||||||
// CD audio will be played when a named stream comes in
|
// CD audio will be played when a named stream comes in
|
||||||
|
|
||||||
m_StreamingAudioInfo.x=x;
|
m_StreamingAudioInfo.x = x;
|
||||||
m_StreamingAudioInfo.y=y;
|
m_StreamingAudioInfo.y = y;
|
||||||
m_StreamingAudioInfo.z=z;
|
m_StreamingAudioInfo.z = z;
|
||||||
m_StreamingAudioInfo.volume=volume;
|
m_StreamingAudioInfo.volume = volume;
|
||||||
m_StreamingAudioInfo.pitch=pitch;
|
m_StreamingAudioInfo.pitch = pitch;
|
||||||
|
|
||||||
if(m_StreamState==eMusicStreamState_Playing)
|
if(m_StreamState == eMusicStreamState_Playing)
|
||||||
{
|
m_StreamState = eMusicStreamState_Stop;
|
||||||
m_StreamState=eMusicStreamState_Stop;
|
else if(m_StreamState == eMusicStreamState_Opening)
|
||||||
}
|
m_StreamState = eMusicStreamState_OpeningCancel;
|
||||||
else if(m_StreamState==eMusicStreamState_Opening)
|
|
||||||
{
|
|
||||||
m_StreamState=eMusicStreamState_OpeningCancel;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(name.empty())
|
if(name.empty())
|
||||||
{
|
{
|
||||||
// music, or stop CD
|
// music, or stop CD
|
||||||
m_StreamingAudioInfo.bIs3D=false;
|
m_StreamingAudioInfo.bIs3D = false;
|
||||||
|
|
||||||
// we need a music id
|
|
||||||
// random delay of up to 3 minutes for music
|
// random delay of up to 3 minutes for music
|
||||||
m_iMusicDelay = random->nextInt(20 * 60 * 3);//random->nextInt(20 * 60 * 10) + 20 * 60 * 10;
|
m_iMusicDelay = random->nextInt(20 * 60 * 3);
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
m_iMusicDelay=0;
|
m_iMusicDelay = 0;
|
||||||
#endif
|
#endif
|
||||||
Minecraft *pMinecraft=Minecraft::GetInstance();
|
|
||||||
|
|
||||||
bool playerInEnd=false;
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
bool playerInNether=false;
|
|
||||||
|
|
||||||
for(unsigned int i=0;i<MAX_LOCAL_PLAYERS;i++)
|
bool playerInEnd = false;
|
||||||
|
bool playerInNether = false;
|
||||||
|
|
||||||
|
// @3UR: the pseudo is so cancer but i am pretty sure this is what they did
|
||||||
|
// IF it is wrong please correct it.
|
||||||
|
unsigned int i = 0;
|
||||||
|
for(i = 0; i < MAX_LOCAL_PLAYERS; i++)
|
||||||
{
|
{
|
||||||
if(pMinecraft->localplayers[i]!=nullptr)
|
if(pMinecraft->localplayers[i] != nullptr)
|
||||||
{
|
{
|
||||||
if(pMinecraft->localplayers[i]->dimension==LevelData::DIMENSION_END)
|
if(pMinecraft->localplayers[i]->dimension == LevelData::DIMENSION_END)
|
||||||
{
|
playerInEnd = true;
|
||||||
playerInEnd=true;
|
else if(pMinecraft->localplayers[i]->dimension == LevelData::DIMENSION_NETHER)
|
||||||
}
|
playerInNether = true;
|
||||||
else if(pMinecraft->localplayers[i]->dimension==LevelData::DIMENSION_NETHER)
|
|
||||||
{
|
|
||||||
playerInNether=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(playerInEnd)
|
if(playerInEnd)
|
||||||
{
|
m_musicID = getMusicID(eMusicDomain_End);
|
||||||
m_musicID = getMusicID(LevelData::DIMENSION_END);
|
|
||||||
}
|
|
||||||
else if(playerInNether)
|
else if(playerInNether)
|
||||||
{
|
m_musicID = getMusicID(eMusicDomain_Nether);
|
||||||
m_musicID = getMusicID(LevelData::DIMENSION_NETHER);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_musicID = getMusicID(LevelData::DIMENSION_OVERWORLD);
|
// @3UR: in ida it looks like they didnt have a var for the player but idc its cleaner
|
||||||
|
MultiplayerLocalPlayer* pPlayer = pMinecraft->localplayers[i-1].get();
|
||||||
|
|
||||||
|
if(pPlayer != nullptr && pPlayer->abilities.instabuild && pPlayer->abilities.mayfly)
|
||||||
|
m_musicID = getMusicID(eMusicDomain_Creative);
|
||||||
|
// TODO(3UR): this is a part of minigames also in the future other minigame ids will need to be handled for now TU30 only checks for BATTLE
|
||||||
|
//else if(pMinecraft->GetCustomGameMode() && CustomGameModeInst::GetId() == EMiniGameId::BATTLE) // @3UR: thanks https://github.com/GRAnimated/MinecraftLCE/blob/6947670d152582457bfe02bd909ee30a7ab7eb55/src/Minecraft.World/net/minecraft/world/level/gamemode/minigames/EMiniGameId.h#L3
|
||||||
|
// m_musicID = getMusicID(eMuszicDomain_Battle);
|
||||||
|
else
|
||||||
|
m_musicID = getMusicID(eMusicDomain_Overworld);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// jukebox
|
// jukebox
|
||||||
m_StreamingAudioInfo.bIs3D=true;
|
m_StreamingAudioInfo.bIs3D=true;
|
||||||
m_musicID=getMusicID(name);
|
m_musicID=getMusicID(name);
|
||||||
m_iMusicDelay=0;
|
m_iMusicDelay=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int SoundEngine::GetRandomishTrack(int iStart,int iEnd)
|
int SoundEngine::GetRandomishTrack(int iStart,int iEnd)
|
||||||
{
|
{
|
||||||
// 4J-PB - make it more likely that we'll get a track we've not heard for a while, although repeating tracks sometimes is fine
|
// 4J-PB - make it more likely that we'll get a track we've not heard for a while, although repeating tracks sometimes is fine
|
||||||
|
|
@ -1305,7 +1322,7 @@ void SoundEngine::playMusicUpdate()
|
||||||
m_StreamState=eMusicStreamState_Stop;
|
m_StreamState=eMusicStreamState_Stop;
|
||||||
|
|
||||||
// Set the end track
|
// Set the end track
|
||||||
m_musicID = getMusicID(LevelData::DIMENSION_END);
|
m_musicID = getMusicID(eMusicDomain_End);
|
||||||
SetIsPlayingEndMusic(true);
|
SetIsPlayingEndMusic(true);
|
||||||
SetIsPlayingNetherMusic(false);
|
SetIsPlayingNetherMusic(false);
|
||||||
}
|
}
|
||||||
|
|
@ -1316,7 +1333,7 @@ void SoundEngine::playMusicUpdate()
|
||||||
m_StreamState=eMusicStreamState_Stop;
|
m_StreamState=eMusicStreamState_Stop;
|
||||||
|
|
||||||
// Set the end track
|
// Set the end track
|
||||||
m_musicID = getMusicID(LevelData::DIMENSION_NETHER);
|
m_musicID = getMusicID(eMusicDomain_Nether);
|
||||||
SetIsPlayingEndMusic(false);
|
SetIsPlayingEndMusic(false);
|
||||||
SetIsPlayingNetherMusic(true);
|
SetIsPlayingNetherMusic(true);
|
||||||
}
|
}
|
||||||
|
|
@ -1325,7 +1342,7 @@ void SoundEngine::playMusicUpdate()
|
||||||
m_StreamState=eMusicStreamState_Stop;
|
m_StreamState=eMusicStreamState_Stop;
|
||||||
|
|
||||||
// Set the end track
|
// Set the end track
|
||||||
m_musicID = getMusicID(LevelData::DIMENSION_OVERWORLD);
|
m_musicID = getMusicID(eMusicDomain_Overworld);
|
||||||
SetIsPlayingEndMusic(false);
|
SetIsPlayingEndMusic(false);
|
||||||
SetIsPlayingNetherMusic(false);
|
SetIsPlayingNetherMusic(false);
|
||||||
}
|
}
|
||||||
|
|
@ -1334,7 +1351,7 @@ void SoundEngine::playMusicUpdate()
|
||||||
{
|
{
|
||||||
m_StreamState=eMusicStreamState_Stop;
|
m_StreamState=eMusicStreamState_Stop;
|
||||||
// set the Nether track
|
// set the Nether track
|
||||||
m_musicID = getMusicID(LevelData::DIMENSION_NETHER);
|
m_musicID = getMusicID(eMusicDomain_Nether);
|
||||||
SetIsPlayingNetherMusic(true);
|
SetIsPlayingNetherMusic(true);
|
||||||
SetIsPlayingEndMusic(false);
|
SetIsPlayingEndMusic(false);
|
||||||
}
|
}
|
||||||
|
|
@ -1344,7 +1361,7 @@ void SoundEngine::playMusicUpdate()
|
||||||
{
|
{
|
||||||
m_StreamState=eMusicStreamState_Stop;
|
m_StreamState=eMusicStreamState_Stop;
|
||||||
// set the Nether track
|
// set the Nether track
|
||||||
m_musicID = getMusicID(LevelData::DIMENSION_END);
|
m_musicID = getMusicID(eMusicDomain_End);
|
||||||
SetIsPlayingNetherMusic(false);
|
SetIsPlayingNetherMusic(false);
|
||||||
SetIsPlayingEndMusic(true);
|
SetIsPlayingEndMusic(true);
|
||||||
}
|
}
|
||||||
|
|
@ -1352,7 +1369,7 @@ void SoundEngine::playMusicUpdate()
|
||||||
{
|
{
|
||||||
m_StreamState=eMusicStreamState_Stop;
|
m_StreamState=eMusicStreamState_Stop;
|
||||||
// set the Nether track
|
// set the Nether track
|
||||||
m_musicID = getMusicID(LevelData::DIMENSION_OVERWORLD);
|
m_musicID = getMusicID(eMusicDomain_Overworld);
|
||||||
SetIsPlayingNetherMusic(false);
|
SetIsPlayingNetherMusic(false);
|
||||||
SetIsPlayingEndMusic(false);
|
SetIsPlayingEndMusic(false);
|
||||||
}
|
}
|
||||||
|
|
@ -1432,19 +1449,19 @@ void SoundEngine::playMusicUpdate()
|
||||||
}
|
}
|
||||||
if(playerInEnd)
|
if(playerInEnd)
|
||||||
{
|
{
|
||||||
m_musicID = getMusicID(LevelData::DIMENSION_END);
|
m_musicID = getMusicID(eMusicDomain_End);
|
||||||
SetIsPlayingEndMusic(true);
|
SetIsPlayingEndMusic(true);
|
||||||
SetIsPlayingNetherMusic(false);
|
SetIsPlayingNetherMusic(false);
|
||||||
}
|
}
|
||||||
else if(playerInNether)
|
else if(playerInNether)
|
||||||
{
|
{
|
||||||
m_musicID = getMusicID(LevelData::DIMENSION_NETHER);
|
m_musicID = getMusicID(eMusicDomain_Nether);
|
||||||
SetIsPlayingNetherMusic(true);
|
SetIsPlayingNetherMusic(true);
|
||||||
SetIsPlayingEndMusic(false);
|
SetIsPlayingEndMusic(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_musicID = getMusicID(LevelData::DIMENSION_OVERWORLD);
|
m_musicID = getMusicID(eMusicDomain_Overworld);
|
||||||
SetIsPlayingNetherMusic(false);
|
SetIsPlayingNetherMusic(false);
|
||||||
SetIsPlayingEndMusic(false);
|
SetIsPlayingEndMusic(false);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,11 @@ enum eMUSICFILES
|
||||||
// The End
|
// The End
|
||||||
eStream_end_dragon,
|
eStream_end_dragon,
|
||||||
eStream_end_end,
|
eStream_end_end,
|
||||||
|
// Battle
|
||||||
|
eStream_BattleMode1,
|
||||||
|
eStream_BattleMode2,
|
||||||
|
eStream_BattleMode3,
|
||||||
|
eStream_BattleMode4,
|
||||||
eStream_CD_1,
|
eStream_CD_1,
|
||||||
eStream_CD_2,
|
eStream_CD_2,
|
||||||
eStream_CD_3,
|
eStream_CD_3,
|
||||||
|
|
@ -62,6 +67,26 @@ enum eMUSICFILES
|
||||||
eStream_Max,
|
eStream_Max,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// @3UR: This may not even be an enum—this is mostly guesswork.
|
||||||
|
// Why? Previously it used LevelData::DIMENSION_XXX enum, and it's unlikely they
|
||||||
|
// would have extended that with all this additional data.
|
||||||
|
// It also does not match up in IDA: LevelData::DIMENSION_END is 1,
|
||||||
|
// but now we see getMusicId(v5, 4); instead of 1.
|
||||||
|
//
|
||||||
|
// This suggests they likely introduced an entirely new enum.
|
||||||
|
//
|
||||||
|
// Additionally, there was never a case for 3, so it's skipped.
|
||||||
|
// That might indicate they extended an existing enum, but it's unclear.
|
||||||
|
enum eMUSICDOMAIN
|
||||||
|
{
|
||||||
|
eMusicDomain_Nether = 0,
|
||||||
|
eMusicDomain_Overworld = 1,
|
||||||
|
eMusicDomain_Menu = 2,
|
||||||
|
eMusicDomain_End = 4,
|
||||||
|
eMusicDomain_Creative = 5,
|
||||||
|
eMusicDomain_Battle = 6,
|
||||||
|
};
|
||||||
|
|
||||||
enum eMUSICTYPE
|
enum eMUSICTYPE
|
||||||
{
|
{
|
||||||
eMusicType_None,
|
eMusicType_None,
|
||||||
|
|
@ -134,7 +159,7 @@ public:
|
||||||
bool isStreamingWavebankReady(); // 4J Added
|
bool isStreamingWavebankReady(); // 4J Added
|
||||||
int getMusicID(int iDomain);
|
int getMusicID(int iDomain);
|
||||||
int getMusicID(const wstring& name);
|
int getMusicID(const wstring& name);
|
||||||
void SetStreamingSounds(int iOverworldMin, int iOverWorldMax, int iNetherMin, int iNetherMax, int iEndMin, int iEndMax, int iCD1);
|
void SetStreamingSounds(int iOverworldMin, int iOverWorldMax, int iNetherMin, int iNetherMax, int iEndMin, int iEndMax, int iCreativeMin, int iCreativeMax, int iMenuMin, int iMenuMax, int iBattleMin, int iBattleMax, int iCD1);
|
||||||
void updateMiniAudio();
|
void updateMiniAudio();
|
||||||
void playMusicUpdate();
|
void playMusicUpdate();
|
||||||
|
|
||||||
|
|
@ -184,6 +209,9 @@ private:
|
||||||
int m_iStream_Overworld_Min,m_iStream_Overworld_Max;
|
int m_iStream_Overworld_Min,m_iStream_Overworld_Max;
|
||||||
int m_iStream_Nether_Min,m_iStream_Nether_Max;
|
int m_iStream_Nether_Min,m_iStream_Nether_Max;
|
||||||
int m_iStream_End_Min,m_iStream_End_Max;
|
int m_iStream_End_Min,m_iStream_End_Max;
|
||||||
|
int m_iStream_Creative_Min,m_iStream_Creative_Max;
|
||||||
|
int m_iStream_Menu_Min,m_iStream_Menu_Max;
|
||||||
|
int m_iStream_Battle_Min,m_iStream_Battle_Max;
|
||||||
int m_iStream_CD_1;
|
int m_iStream_CD_1;
|
||||||
bool *m_bHeardTrackA;
|
bool *m_bHeardTrackA;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3791,10 +3791,13 @@ void CMinecraftApp::HandleXuiActions(void)
|
||||||
// need to stop the streaming audio - by playing streaming audio from the default texture pack now
|
// need to stop the streaming audio - by playing streaming audio from the default texture pack now
|
||||||
// reset the streaming sounds back to the normal ones
|
// reset the streaming sounds back to the normal ones
|
||||||
#ifndef _XBOX
|
#ifndef _XBOX
|
||||||
pMinecraft->soundEngine->SetStreamingSounds(eStream_Overworld_Calm1,eStream_Overworld_piano3,
|
pMinecraft->soundEngine->SetStreamingSounds(eStream_Overworld_Calm1,eStream_Overworld_piano3,
|
||||||
eStream_Nether1,eStream_Nether4,
|
eStream_Nether1,eStream_Nether4,
|
||||||
eStream_end_dragon,eStream_end_end,
|
eStream_end_dragon,eStream_end_end,
|
||||||
eStream_CD_1);
|
eStream_Overworld_Creative1,eStream_Overworld_Creative6,
|
||||||
|
eStream_Overworld_Menu1,eStream_Overworld_Menu4,
|
||||||
|
eStream_BattleMode1,eStream_BattleMode4,
|
||||||
|
eStream_CD_1);
|
||||||
#endif
|
#endif
|
||||||
pMinecraft->soundEngine->playStreaming(L"", 0, 0, 0, 1, 1);
|
pMinecraft->soundEngine->playStreaming(L"", 0, 0, 0, 1, 1);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,10 +26,12 @@ PBYTE DLCAudioFile::getData(DWORD &dwBytes)
|
||||||
return m_pbData;
|
return m_pbData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @3UR: thanks https://github.com/LCERD/PCK-Studio/blob/500fc74395ce99fe20cbd7598999bfab3b606745/PckStudio.Core/IO/PckAudio/PckAudioFileWriter.cs#L15
|
||||||
const WCHAR *DLCAudioFile::wchTypeNamesA[]=
|
const WCHAR *DLCAudioFile::wchTypeNamesA[]=
|
||||||
{
|
{
|
||||||
L"CUENAME",
|
L"CUENAME",
|
||||||
L"CREDIT",
|
L"CREDIT",
|
||||||
|
L"CREDITID",
|
||||||
};
|
};
|
||||||
|
|
||||||
DLCAudioFile::EAudioParameterType DLCAudioFile::getParameterType(const wstring ¶mName)
|
DLCAudioFile::EAudioParameterType DLCAudioFile::getParameterType(const wstring ¶mName)
|
||||||
|
|
@ -76,7 +78,7 @@ void DLCAudioFile::addParameter(EAudioType type, EAudioParameterType ptype, cons
|
||||||
case XC_LANGUAGE_JAPANESE:
|
case XC_LANGUAGE_JAPANESE:
|
||||||
case XC_LANGUAGE_TCHINESE:
|
case XC_LANGUAGE_TCHINESE:
|
||||||
case XC_LANGUAGE_KOREAN:
|
case XC_LANGUAGE_KOREAN:
|
||||||
maximumChars = 35;
|
maximumChars = 55; // @3UR: this is 55 in TU30
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
wstring creditValue = value;
|
wstring creditValue = value;
|
||||||
|
|
@ -88,23 +90,6 @@ void DLCAudioFile::addParameter(EAudioType type, EAudioParameterType ptype, cons
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
size_t iLast=creditValue.find_last_of(L" ", i);
|
size_t iLast=creditValue.find_last_of(L" ", i);
|
||||||
switch(XGetLanguage())
|
|
||||||
{
|
|
||||||
case XC_LANGUAGE_JAPANESE:
|
|
||||||
case XC_LANGUAGE_TCHINESE:
|
|
||||||
case XC_LANGUAGE_KOREAN:
|
|
||||||
iLast = maximumChars;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
iLast=creditValue.find_last_of(L" ", i);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if a space was found, include the space on this line
|
|
||||||
if(iLast!=i)
|
|
||||||
{
|
|
||||||
iLast++;
|
|
||||||
}
|
|
||||||
|
|
||||||
app.AddCreditText((creditValue.substr(0, iLast)).c_str());
|
app.AddCreditText((creditValue.substr(0, iLast)).c_str());
|
||||||
creditValue = creditValue.substr(iLast);
|
creditValue = creditValue.substr(iLast);
|
||||||
|
|
@ -117,6 +102,9 @@ void DLCAudioFile::addParameter(EAudioType type, EAudioParameterType ptype, cons
|
||||||
m_parameters[type].push_back(value);
|
m_parameters[type].push_back(value);
|
||||||
//m_parameters[(int)type] = value;
|
//m_parameters[(int)type] = value;
|
||||||
break;
|
break;
|
||||||
|
// @3UR: in IDA for TU30 this is literally just empty...
|
||||||
|
case e_AudioParamType_CreditId:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,15 @@ public:
|
||||||
|
|
||||||
e_AudioType_Overworld = 0,
|
e_AudioType_Overworld = 0,
|
||||||
e_AudioType_Nether,
|
e_AudioType_Nether,
|
||||||
e_AudioType_End,
|
e_AudioType_End,
|
||||||
|
|
||||||
|
// @3UR: thanks https://github.com/LCERD/PCK-Studio/blob/500fc74395ce99fe20cbd7598999bfab3b606745/PckStudio.Core/FileFormats/PckAudioFile.cs#L25
|
||||||
|
e_AudioType_Creative,
|
||||||
|
e_AudioType_Menu,
|
||||||
|
e_AudioType_Battle,
|
||||||
|
e_AudioType_Tumble,
|
||||||
|
e_AudioType_Glide,
|
||||||
|
e_AudioType_BuildOff,
|
||||||
|
|
||||||
e_AudioType_Max,
|
e_AudioType_Max,
|
||||||
};
|
};
|
||||||
|
|
@ -24,6 +32,7 @@ public:
|
||||||
|
|
||||||
e_AudioParamType_Cuename = 0,
|
e_AudioParamType_Cuename = 0,
|
||||||
e_AudioParamType_Credit,
|
e_AudioParamType_Credit,
|
||||||
|
e_AudioParamType_CreditId,
|
||||||
|
|
||||||
e_AudioParamType_Max,
|
e_AudioParamType_Max,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2064,10 +2064,13 @@ void UIController::NavigateToHomeMenu()
|
||||||
{
|
{
|
||||||
// need to stop the streaming audio - by playing streaming audio from the default texture pack now
|
// need to stop the streaming audio - by playing streaming audio from the default texture pack now
|
||||||
// reset the streaming sounds back to the normal ones
|
// reset the streaming sounds back to the normal ones
|
||||||
pMinecraft->soundEngine->SetStreamingSounds(eStream_Overworld_Calm1,eStream_Overworld_piano3,
|
pMinecraft->soundEngine->SetStreamingSounds(eStream_Overworld_Calm1,eStream_Overworld_piano3,
|
||||||
eStream_Nether1,eStream_Nether4,
|
eStream_Nether1,eStream_Nether4,
|
||||||
eStream_end_dragon,eStream_end_end,
|
eStream_end_dragon,eStream_end_end,
|
||||||
eStream_CD_1);
|
eStream_Overworld_Creative1,eStream_Overworld_Creative6,
|
||||||
|
eStream_Overworld_Menu1,eStream_Overworld_Menu4,
|
||||||
|
eStream_BattleMode1,eStream_BattleMode4,
|
||||||
|
eStream_CD_1);
|
||||||
pMinecraft->soundEngine->playStreaming(L"", 0, 0, 0, 1, 1);
|
pMinecraft->soundEngine->playStreaming(L"", 0, 0, 0, 1, 1);
|
||||||
|
|
||||||
// if(pDLCTexPack->m_pStreamedWaveBank!=nullptr)
|
// if(pDLCTexPack->m_pStreamedWaveBank!=nullptr)
|
||||||
|
|
|
||||||
|
|
@ -473,18 +473,63 @@ int DLCTexturePack::packMounted(LPVOID pParam,int iPad,DWORD dwErr,DWORD dwLicen
|
||||||
DLCAudioFile *dlcFile = static_cast<DLCAudioFile *>(pack->getFile(DLCManager::e_DLCType_Audio, 0));
|
DLCAudioFile *dlcFile = static_cast<DLCAudioFile *>(pack->getFile(DLCManager::e_DLCType_Audio, 0));
|
||||||
texturePack->setHasAudio(true);
|
texturePack->setHasAudio(true);
|
||||||
// init the streaming sound ids for this texture pack
|
// init the streaming sound ids for this texture pack
|
||||||
int iOverworldStart, iNetherStart, iEndStart;
|
int iOverworldC=dlcFile->GetCountofType(DLCAudioFile::e_AudioType_Overworld);
|
||||||
int iOverworldC, iNetherC, iEndC;
|
int iNetherC=dlcFile->GetCountofType(DLCAudioFile::e_AudioType_Nether);
|
||||||
|
int iEndStart=iOverworldC+iNetherC;
|
||||||
|
int iEndC=dlcFile->GetCountofType(DLCAudioFile::e_AudioType_End);
|
||||||
|
int iAfterEnd=iOverworldC+iNetherC+iEndC;
|
||||||
|
int iCreativeC=dlcFile->GetCountofType(DLCAudioFile::e_AudioType_Creative);
|
||||||
|
|
||||||
iOverworldStart=0;
|
int iCreativeStart, iCreativeRange;
|
||||||
iOverworldC=dlcFile->GetCountofType(DLCAudioFile::e_AudioType_Overworld);
|
if(iCreativeC)
|
||||||
iNetherStart=iOverworldC;
|
{
|
||||||
iNetherC=dlcFile->GetCountofType(DLCAudioFile::e_AudioType_Nether);
|
iCreativeStart=iAfterEnd;
|
||||||
iEndStart=iOverworldC+iNetherC;
|
iCreativeRange=iCreativeC;
|
||||||
iEndC=dlcFile->GetCountofType(DLCAudioFile::e_AudioType_End);
|
iAfterEnd+=iCreativeC;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
iCreativeStart=0;
|
||||||
|
iCreativeRange=iOverworldC;
|
||||||
|
}
|
||||||
|
|
||||||
Minecraft::GetInstance()->soundEngine->SetStreamingSounds(iOverworldStart,iOverworldStart+iOverworldC-1,
|
int iMenuC=dlcFile->GetCountofType(DLCAudioFile::e_AudioType_Menu);
|
||||||
iNetherStart,iNetherStart+iNetherC-1,iEndStart,iEndStart+iEndC-1,iEndStart+iEndC); // push the CD start to after
|
int iMenuStart, iMenuRange;
|
||||||
|
if(iMenuC)
|
||||||
|
{
|
||||||
|
iMenuStart=iAfterEnd;
|
||||||
|
iMenuRange=iMenuC;
|
||||||
|
iAfterEnd+=iMenuC;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
iMenuStart=0;
|
||||||
|
iMenuRange=iOverworldC;
|
||||||
|
}
|
||||||
|
|
||||||
|
int iBattleC=dlcFile->GetCountofType(DLCAudioFile::e_AudioType_Battle);
|
||||||
|
if(iBattleC)
|
||||||
|
{
|
||||||
|
Minecraft::GetInstance()->soundEngine->SetStreamingSounds(
|
||||||
|
0,iOverworldC-1,
|
||||||
|
iOverworldC,iOverworldC+iNetherC-1,
|
||||||
|
iEndStart,iEndStart+iEndC-1,
|
||||||
|
iCreativeStart,iCreativeStart+iCreativeRange-1,
|
||||||
|
iMenuStart,iMenuStart+iMenuRange-1,
|
||||||
|
iAfterEnd,iAfterEnd+iBattleC-1,
|
||||||
|
iAfterEnd+iBattleC);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Minecraft::GetInstance()->soundEngine->SetStreamingSounds(
|
||||||
|
0,iOverworldC-1,
|
||||||
|
iOverworldC,iOverworldC+iNetherC-1,
|
||||||
|
iEndStart,iEndStart+iEndC-1,
|
||||||
|
iCreativeStart,iCreativeStart+iCreativeRange-1,
|
||||||
|
iMenuStart,iMenuStart+iMenuRange-1,
|
||||||
|
0,iOverworldC-1,
|
||||||
|
iAfterEnd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue