mirror of
https://git.neolegacy.dev/neoStudiosLCE/neoLegacy.git
synced 2026-12-02 22:18:09 +01:00
Reapply "Minecraft.World: C4JThread: Update Threader from Portable-LCE"
This reverts commit 6300671276.
This commit is contained in:
1 parent
e10f2859f4
commit
96a2beb04b
18 files changed
+843
-1369
No files matched your search
@@ -34,10 +34,10 @@ constexpr float MUSIC_FADE_DURATION_SECONDS = 4.0f;
|
||||
#ifdef __ORBIS__
|
||||
#include <audioout.h>
|
||||
//#define __DISABLE_MILES__ // MGH disabled for now as it crashes if we call sceNpMatching2Initialize
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// take out Orbis until they are done
|
||||
#if defined _XBOX
|
||||
#if defined _XBOX
|
||||
|
||||
SoundEngine::SoundEngine() {}
|
||||
void SoundEngine::init(Options *pOptions)
|
||||
@@ -161,13 +161,13 @@ const char *SoundEngine::m_szStreamFileA[eStream_Max]=
|
||||
// The End
|
||||
"the_end_dragon_alive",
|
||||
"the_end_end",
|
||||
|
||||
|
||||
// Battle
|
||||
"BattleMode1",
|
||||
"BattleMode2",
|
||||
"BattleMode3",
|
||||
"BattleMode4",
|
||||
|
||||
|
||||
// CDs
|
||||
"11",
|
||||
"13",
|
||||
@@ -209,11 +209,11 @@ void SoundEngine::init(Options* pOptions)
|
||||
m_MasterEffectsVolume = 1.0f;
|
||||
|
||||
m_validListenerCount = 1;
|
||||
|
||||
|
||||
m_bSystemMusicPlaying = false;
|
||||
|
||||
app.DebugPrintf("---miniaudio initialized\n");
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -402,7 +402,7 @@ void SoundEngine::tick(shared_ptr<Mob> *players, float a)
|
||||
// store the listener positions for splitscreen
|
||||
m_ListenerA[i].vPosition.x = x;
|
||||
m_ListenerA[i].vPosition.y = y;
|
||||
m_ListenerA[i].vPosition.z = z;
|
||||
m_ListenerA[i].vPosition.z = z;
|
||||
|
||||
m_ListenerA[i].vOrientFront.x = -ySin;
|
||||
m_ListenerA[i].vOrientFront.y = 0;
|
||||
@@ -452,7 +452,7 @@ SoundEngine::SoundEngine()
|
||||
m_musicStreamActive = false;
|
||||
m_StreamState=eMusicStreamState_Idle;
|
||||
m_iMusicDelay=0;
|
||||
m_validListenerCount=0;
|
||||
m_validListenerCount=0;
|
||||
|
||||
m_bHeardTrackA=nullptr;
|
||||
|
||||
@@ -542,7 +542,7 @@ void SoundEngine::play(int iSound, float x, float y, float z, float volume, floa
|
||||
{
|
||||
char basePlusExt[256];
|
||||
sprintf_s(basePlusExt, "%s%s", basePath, extensions[extIdx]);
|
||||
|
||||
|
||||
DWORD attr = GetFileAttributesA(basePlusExt);
|
||||
if (attr != INVALID_FILE_ATTRIBUTES && !(attr & FILE_ATTRIBUTE_DIRECTORY))
|
||||
{
|
||||
@@ -562,7 +562,7 @@ void SoundEngine::play(int iSound, float x, float y, float z, float volume, floa
|
||||
{
|
||||
char numberedPath[256];
|
||||
sprintf_s(numberedPath, "%s%d%s", basePath, i, extensions[extIdx]);
|
||||
|
||||
|
||||
DWORD attr = GetFileAttributesA(numberedPath);
|
||||
if (attr != INVALID_FILE_ATTRIBUTES && !(attr & FILE_ATTRIBUTE_DIRECTORY))
|
||||
{
|
||||
@@ -578,7 +578,7 @@ void SoundEngine::play(int iSound, float x, float y, float z, float volume, floa
|
||||
{
|
||||
char numberedPath[256];
|
||||
sprintf_s(numberedPath, "%s%d%s", basePath, chosen, extensions[extIdx]);
|
||||
|
||||
|
||||
DWORD attr = GetFileAttributesA(numberedPath);
|
||||
if (attr != INVALID_FILE_ATTRIBUTES && !(attr & FILE_ATTRIBUTE_DIRECTORY))
|
||||
{
|
||||
@@ -600,7 +600,7 @@ void SoundEngine::play(int iSound, float x, float y, float z, float volume, floa
|
||||
s->info.x = x;
|
||||
s->info.y = y;
|
||||
s->info.z = z;
|
||||
|
||||
|
||||
s->info.volume = volume;
|
||||
s->info.pitch = pitch;
|
||||
s->info.bIs3D = true;
|
||||
@@ -725,7 +725,7 @@ void SoundEngine::stopLoopingSound(MiniAudioSound* sound)
|
||||
|
||||
/////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
//
|
||||
// startElytraSound / stopElytraSound
|
||||
// Manages a single persistent looping sound for elytra gliding.
|
||||
// Call startElytraSound every tick while gliding (it no-ops if already running,
|
||||
@@ -966,7 +966,7 @@ void SoundEngine::playStreaming(const wstring& name, float x, float y, float z,
|
||||
m_bCurrentStreamIsMenuMusic = false;
|
||||
m_musicID = getMusicID(name);
|
||||
m_iMusicDelay = 0;
|
||||
|
||||
|
||||
if (m_StreamState == eMusicStreamState_Playing || m_StreamState == eMusicStreamState_Opening || m_musicStreamActive)
|
||||
{
|
||||
m_StreamState = eMusicStreamState_Fading;
|
||||
@@ -1061,7 +1061,7 @@ int SoundEngine::getMusicID(eMusicType iDomain)
|
||||
return GetRandomishTrack(m_iStream_Overworld_Min,m_iStream_Overworld_Max);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
switch(iDomain)
|
||||
{
|
||||
case eMusicType_Nether:
|
||||
@@ -1154,7 +1154,7 @@ void SoundEngine::updateSystemMusicPlaying(bool isPlaying)
|
||||
// updateSoundEffectVolume
|
||||
//
|
||||
/////////////////////////////////////////////
|
||||
void SoundEngine::updateSoundEffectVolume(float fVal)
|
||||
void SoundEngine::updateSoundEffectVolume(float fVal)
|
||||
{
|
||||
m_MasterEffectsVolume=fVal;
|
||||
//AIL_set_variable_float(0,"UserEffectVol",fVal);
|
||||
@@ -1170,7 +1170,7 @@ int SoundEngine::OpenStreamThreadProc(void* lpParameter)
|
||||
SoundEngine* soundEngine = (SoundEngine*)lpParameter;
|
||||
|
||||
const char* ext = strrchr(soundEngine->m_szStreamName, '.');
|
||||
|
||||
|
||||
if (soundEngine->m_musicStreamActive)
|
||||
{
|
||||
ma_sound_stop(&soundEngine->m_musicStream);
|
||||
@@ -1205,7 +1205,7 @@ int SoundEngine::OpenStreamThreadProc(void* lpParameter)
|
||||
// playMusicTick
|
||||
//
|
||||
/////////////////////////////////////////////
|
||||
void SoundEngine::playMusicTick()
|
||||
void SoundEngine::playMusicTick()
|
||||
{
|
||||
// AP - vita will update the music during the mixer callback
|
||||
#ifndef __PSVITA__
|
||||
@@ -1214,7 +1214,7 @@ void SoundEngine::playMusicTick()
|
||||
}
|
||||
|
||||
// AP - moved to a separate function so it can be called from the mixer callback on Vita
|
||||
void SoundEngine::playMusicUpdate()
|
||||
void SoundEngine::playMusicUpdate()
|
||||
{
|
||||
static float fMusicVol = 0.0f;
|
||||
fMusicVol = getMasterMusicVolume();
|
||||
@@ -1248,7 +1248,7 @@ void SoundEngine::playMusicUpdate()
|
||||
// 4J-PB - Need to check if we are a patched BD build
|
||||
if(app.GetBootedFromDiscPatch())
|
||||
{
|
||||
sprintf(m_szStreamName,"%s/%s",app.GetBDUsrDirPath(m_szMusicPath), m_szMusicPath );
|
||||
sprintf(m_szStreamName,"%s/%s",app.GetBDUsrDirPath(m_szMusicPath), m_szMusicPath );
|
||||
app.DebugPrintf("SoundEngine::playMusicUpdate - (booted from disc patch) music path - %s",m_szStreamName);
|
||||
}
|
||||
else
|
||||
@@ -1282,7 +1282,7 @@ void SoundEngine::playMusicUpdate()
|
||||
SetIsPlayingStreamingGameMusic(true);
|
||||
SetIsPlayingStreamingCDMusic(false);
|
||||
m_StreamingAudioInfo.bIs3D=false;
|
||||
|
||||
|
||||
#ifdef _XBOX_ONE
|
||||
wstring &wstrSoundName=dlcAudioFile->GetSoundName(m_musicID);
|
||||
wstring wstrFile=L"TPACK:\\Data\\" + wstrSoundName +L".wav";
|
||||
@@ -1315,7 +1315,7 @@ void SoundEngine::playMusicUpdate()
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
// 4J-PB - if this is a PS3 disc patch, we have to check if the music file is in the patch data
|
||||
#ifdef __PS3__
|
||||
if(app.GetBootedFromDiscPatch() && (m_musicID<m_iStream_CD_1))
|
||||
@@ -1327,7 +1327,7 @@ void SoundEngine::playMusicUpdate()
|
||||
strcat((char *)m_szStreamName,".wav");
|
||||
|
||||
// check if this is in the patch data
|
||||
sprintf(m_szStreamName,"%s/%s",app.GetBDUsrDirPath(m_szStreamName), m_szMusicPath );
|
||||
sprintf(m_szStreamName,"%s/%s",app.GetBDUsrDirPath(m_szStreamName), m_szMusicPath );
|
||||
strcat((char *)m_szStreamName,"music/");
|
||||
strcat((char *)m_szStreamName,m_szStreamFileA[m_musicID]);
|
||||
strcat((char *)m_szStreamName,".wav");
|
||||
@@ -1357,7 +1357,7 @@ void SoundEngine::playMusicUpdate()
|
||||
strcat((char *)m_szStreamName,m_szStreamFileA[m_musicID]);
|
||||
strcat((char *)m_szStreamName,".wav");
|
||||
}
|
||||
#else
|
||||
#else
|
||||
if(m_musicID<m_iStream_CD_1)
|
||||
{
|
||||
SetIsPlayingStreamingGameMusic(true);
|
||||
@@ -1376,7 +1376,7 @@ void SoundEngine::playMusicUpdate()
|
||||
}
|
||||
strcat((char *)m_szStreamName,m_szStreamFileA[m_musicID]);
|
||||
strcat((char *)m_szStreamName,".wav");
|
||||
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1385,7 +1385,7 @@ void SoundEngine::playMusicUpdate()
|
||||
// strcat((char *)szStreamName,SoundName);
|
||||
|
||||
FILE* pFile = nullptr;
|
||||
|
||||
|
||||
if (fopen_s(&pFile, reinterpret_cast<char*>(m_szStreamName), "rb") == 0 && pFile)
|
||||
{
|
||||
fclose(pFile);
|
||||
@@ -1402,7 +1402,7 @@ void SoundEngine::playMusicUpdate()
|
||||
for (size_t i = 0; i < extCount; i++)
|
||||
{
|
||||
strcpy_s(dotPos, 5, extensions[i]);
|
||||
|
||||
|
||||
if (fopen_s(&pFile, reinterpret_cast<char*>(m_szStreamName), "rb") == 0 && pFile)
|
||||
{
|
||||
fclose(pFile);
|
||||
@@ -1431,7 +1431,7 @@ void SoundEngine::playMusicUpdate()
|
||||
break;
|
||||
|
||||
case eMusicStreamState_Opening:
|
||||
if( !m_openStreamThread->isRunning() )
|
||||
if( !m_openStreamThread->IsRunning() )
|
||||
{
|
||||
delete m_openStreamThread;
|
||||
m_openStreamThread = nullptr;
|
||||
@@ -1445,27 +1445,27 @@ void SoundEngine::playMusicUpdate()
|
||||
{
|
||||
const bool isCD = (m_musicID >= m_iStream_CD_1);
|
||||
const char* folder = isCD ? "cds/" : "music/";
|
||||
|
||||
|
||||
int n = sprintf_s(reinterpret_cast<char*>(m_szStreamName), 512, "%s%s%s.wav", m_szMusicPath, folder, m_szStreamFileA[m_musicID]);
|
||||
|
||||
|
||||
if (n > 0)
|
||||
{
|
||||
FILE* pFile = nullptr;
|
||||
if (fopen_s(&pFile, reinterpret_cast<char*>(m_szStreamName), "rb") == 0 && pFile)
|
||||
{
|
||||
fclose(pFile);
|
||||
|
||||
|
||||
m_openStreamThread = new C4JThread(OpenStreamThreadProc, this, "OpenStreamThreadProc");
|
||||
m_openStreamThread->Run();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
m_StreamState = eMusicStreamState_Idle;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (m_StreamingAudioInfo.bIs3D)
|
||||
{
|
||||
ma_sound_set_spatialization_enabled(&m_musicStream, MA_TRUE);
|
||||
@@ -1520,7 +1520,7 @@ void SoundEngine::playMusicUpdate()
|
||||
}
|
||||
break;
|
||||
case eMusicStreamState_OpeningCancel:
|
||||
if( !m_openStreamThread->isRunning() )
|
||||
if( !m_openStreamThread->IsRunning() )
|
||||
{
|
||||
delete m_openStreamThread;
|
||||
m_openStreamThread = nullptr;
|
||||
@@ -1625,7 +1625,7 @@ void SoundEngine::playMusicUpdate()
|
||||
// Set the end track
|
||||
m_musicID = getMusicID(eMusicType_End);
|
||||
SetIsPlayingEndMusic(true);
|
||||
SetIsPlayingNetherMusic(false);
|
||||
SetIsPlayingNetherMusic(false);
|
||||
}
|
||||
else if(!playerInEnd && GetIsPlayingEndMusic())
|
||||
{
|
||||
@@ -1636,7 +1636,7 @@ void SoundEngine::playMusicUpdate()
|
||||
// Set the end track
|
||||
m_musicID = getMusicID(eMusicType_Nether);
|
||||
SetIsPlayingEndMusic(false);
|
||||
SetIsPlayingNetherMusic(true);
|
||||
SetIsPlayingNetherMusic(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1645,7 +1645,7 @@ void SoundEngine::playMusicUpdate()
|
||||
// Set the end track
|
||||
m_musicID = getMusicID(eMusicType_Overworld);
|
||||
SetIsPlayingEndMusic(false);
|
||||
SetIsPlayingNetherMusic(false);
|
||||
SetIsPlayingNetherMusic(false);
|
||||
}
|
||||
}
|
||||
else if (playerInNether && !GetIsPlayingNetherMusic())
|
||||
@@ -1728,7 +1728,7 @@ void SoundEngine::playMusicUpdate()
|
||||
break;
|
||||
|
||||
case eMusicStreamState_Completed:
|
||||
{
|
||||
{
|
||||
// random delay of up to 3 minutes for music
|
||||
m_iMusicDelay = random->nextInt(20 * 60 * 3);//random->nextInt(20 * 60 * 10) + 20 * 60 * 10;
|
||||
// Check if we have a local player in The Nether or in The End, and play that music if they are
|
||||
|
||||
Reference in new issue
Block a user