From aca956007930808694bbde70f7c9a78ece66a7ff Mon Sep 17 00:00:00 2001 From: NaN Date: Tue, 4 Aug 2026 01:31:55 -0400 Subject: [PATCH] ps4 support final --- Minecraft.Client/Common/Audio/SoundEngine.cpp | 21 +++++++++++++++++++ .../Windows64/Windows64_Minecraft.cpp | 4 ++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/Minecraft.Client/Common/Audio/SoundEngine.cpp b/Minecraft.Client/Common/Audio/SoundEngine.cpp index dc813f6e..ee1fcc53 100644 --- a/Minecraft.Client/Common/Audio/SoundEngine.cpp +++ b/Minecraft.Client/Common/Audio/SoundEngine.cpp @@ -203,6 +203,14 @@ void AILCALL MilesMixerCB(HDIGDRIVER dig) void SoundEngine::init(Options *pOptions) { app.DebugPrintf("---SoundEngine::init\n"); +#ifdef _WINDOWS64 + HMODULE ntdll = GetModuleHandleA("ntdll.dll"); + if (ntdll != NULL && GetProcAddress(ntdll, "wine_get_version") != NULL) + { + app.DebugPrintf("---SoundEngine::init - Miles disabled under Wine\n"); + return; + } +#endif #ifdef __DISABLE_MILES__ return; #endif @@ -402,6 +410,7 @@ void SoundEngine::SetStreamingSounds(int iOverworldMin, int iOverWorldMax, int i // AP - moved to a separate function so it can be called from the mixer callback on Vita void SoundEngine::updateMiles() { + if (m_hDriver == 0) return; #ifdef __PSVITA__ //CD - We must check for Background Music [BGM] at any point //If it's playing disable our audio, otherwise enable @@ -630,6 +639,7 @@ static S32 running = AIL_ms_count(); void SoundEngine::tick(shared_ptr *players, float a) { ConsoleSoundEngine::tick(); + if (m_hDriver == 0) return; #ifdef __DISABLE_MILES__ return; #endif @@ -710,7 +720,13 @@ void SoundEngine::tick(shared_ptr *players, float a) SoundEngine::SoundEngine() { random = new Random(); + m_hBank=0; + m_hDriver=0; m_hStream=0; + m_MasterMusicVolume=1.0f; + m_MasterEffectsVolume=1.0f; + m_bSystemMusicPlaying=false; + m_openStreamThread=NULL; m_StreamState=eMusicStreamState_Idle; m_iMusicDelay=0; m_validListenerCount=0; @@ -759,6 +775,7 @@ void SoundEngine::GetSoundName(char *szSoundName,int iSound) ///////////////////////////////////////////// void SoundEngine::play(int iSound, float x, float y, float z, float volume, float pitch) { + if (m_hDriver == 0) return; U8 szSoundName[256]; if(iSound==-1) @@ -818,6 +835,7 @@ void SoundEngine::play(int iSound, float x, float y, float z, float volume, floa ///////////////////////////////////////////// void SoundEngine::playUI(int iSound, float volume, float pitch) { + if (m_hDriver == 0) return; U8 szSoundName[256]; wstring name; // we have some game sounds played as UI sounds... @@ -1134,6 +1152,7 @@ int SoundEngine::OpenStreamThreadProc( void* lpParameter ) return 0; #endif SoundEngine *soundEngine = (SoundEngine *)lpParameter; + if (soundEngine->m_hDriver == 0) return 0; soundEngine->m_hStream = AIL_open_stream(soundEngine->m_hDriver,soundEngine->m_szStreamName,0); if(soundEngine->m_hStream==0) @@ -1150,6 +1169,7 @@ int SoundEngine::OpenStreamThreadProc( void* lpParameter ) ///////////////////////////////////////////// void SoundEngine::playMusicTick() { + if (m_hDriver == 0) return; // AP - vita will update the music during the mixer callback #ifndef __PSVITA__ playMusicUpdate(); @@ -1159,6 +1179,7 @@ void SoundEngine::playMusicTick() // AP - moved to a separate function so it can be called from the mixer callback on Vita void SoundEngine::playMusicUpdate() { + if (m_hDriver == 0) return; //return; static bool firstCall = true; static float fMusicVol = 0.0f; diff --git a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp index 9a45bb88..6f00d0f5 100644 --- a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp +++ b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp @@ -503,13 +503,13 @@ app.DebugPrintf("width: %d, height: %d\n", width, height); DXGI_SWAP_CHAIN_DESC sd; ZeroMemory( &sd, sizeof( sd ) ); - sd.BufferCount = 2; + sd.BufferCount = 1; sd.BufferDesc.Width = width; sd.BufferDesc.Height = height; sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; sd.BufferDesc.RefreshRate.Numerator = 60; sd.BufferDesc.RefreshRate.Denominator = 1; - sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; + sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT | DXGI_USAGE_SHADER_INPUT; sd.OutputWindow = g_hWnd; sd.SampleDesc.Count = 1; sd.SampleDesc.Quality = 0;