From 965daea4558e6fc4b148bda359cc19128f70bc6e Mon Sep 17 00:00:00 2001 From: sum2012 Date: Sun, 14 Aug 2022 09:51:49 +0800 Subject: [PATCH 1/5] Add atrac hack setting --- Core/Config.cpp | 1 + Core/Config.h | 1 + Core/HLE/sceAtrac.cpp | 5 +++++ UI/GameSettingsScreen.cpp | 1 + assets/lang/en_US.ini | 1 + assets/lang/zh_CN.ini | 1 + assets/lang/zh_TW.ini | 1 + 7 files changed, 11 insertions(+) diff --git a/Core/Config.cpp b/Core/Config.cpp index 91264ca5b4..1cf2bde22a 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -956,6 +956,7 @@ static ConfigSetting soundSettings[] = { ConfigSetting("AltSpeedVolume", &g_Config.iAltSpeedVolume, -1, true, true), ConfigSetting("AudioDevice", &g_Config.sAudioDevice, "", true, false), ConfigSetting("AutoAudioDevice", &g_Config.bAutoAudioDevice, true, true, false), + ConfigSetting("HackSound", &g_Config.bHackSound, false, true, false), ConfigSetting(false), }; diff --git a/Core/Config.h b/Core/Config.h index e682234ba3..0939c89ed3 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -256,6 +256,7 @@ public: bool bExtraAudioBuffering; // For bluetooth std::string sAudioDevice; bool bAutoAudioDevice; + bool bHackSound; // UI bool bShowDebuggerOnLoad; diff --git a/Core/HLE/sceAtrac.cpp b/Core/HLE/sceAtrac.cpp index 6a7559ab7e..6a2c619842 100644 --- a/Core/HLE/sceAtrac.cpp +++ b/Core/HLE/sceAtrac.cpp @@ -1170,6 +1170,11 @@ static u32 sceAtracAddStreamData(int atracID, u32 bytesToAdd) { atrac->first_.offset += bytesToAdd; atrac->bufferValidBytes_ += bytesToAdd; + if (g_Config.bHackSound && atrac->bufferState_ == ATRAC_STATUS_STREAMED_LOOP_FROM_END && atrac->RemainingFrames() > 2) { // Code Lyoko don't like SeekToSample for unknown reason + atrac->loopNum_++; + atrac->SeekToSample(atrac->loopStartSample_ - atrac->FirstOffsetExtra() - atrac->firstSampleOffset_); + } + return hleLogSuccessI(ME, 0); } diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index a21fcde46f..5b3cf71d5d 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -693,6 +693,7 @@ void GameSettingsScreen::CreateViews() { PopupMultiChoiceDynamic *MicChoice = audioSettings->Add(new PopupMultiChoiceDynamic(&g_Config.sMicDevice, a->T("Microphone Device"), micList, nullptr, screenManager())); MicChoice->OnChoice.Handle(this, &GameSettingsScreen::OnMicDeviceChange); } + audioSettings->Add(new CheckBox(&g_Config.bHackSound, a->T("Hack sound"))); // Control LinearLayout *controlsSettings = AddTab("GameSettingsControls", ms->T("Controls")); diff --git a/assets/lang/en_US.ini b/assets/lang/en_US.ini index 2d696f4ee4..b929cbe199 100644 --- a/assets/lang/en_US.ini +++ b/assets/lang/en_US.ini @@ -33,6 +33,7 @@ Disabled = Disabled DSound (compatible) = DSound (compatible) Enable Sound = Enable sound Global volume = Global volume +Hack sound = Hack sound Microphone = Microphone Microphone Device = Microphone device Mute = Mute diff --git a/assets/lang/zh_CN.ini b/assets/lang/zh_CN.ini index 93ba6ebe35..430f122c08 100644 --- a/assets/lang/zh_CN.ini +++ b/assets/lang/zh_CN.ini @@ -9,6 +9,7 @@ Disabled = 禁用 DSound (compatible) = DirectSound(兼容) Enable Sound = 开启声音 Global volume = 全局音量 +Hack sound = 破解声音修复 Microphone = 麦克风 Microphone Device = 麦克风设备 Mute = 静音 diff --git a/assets/lang/zh_TW.ini b/assets/lang/zh_TW.ini index 86670da9e3..5b55d4e293 100644 --- a/assets/lang/zh_TW.ini +++ b/assets/lang/zh_TW.ini @@ -9,6 +9,7 @@ Disabled = Disabled DSound (compatible) = DirectSound(兼容) Enable Sound = 啟用音效 Global volume = 全局音量 +Hack sound = 破解聲音修復 Microphone = Microphone Microphone Device = 麥克風裝置 Mute = 靜音 From e373c9063c0e8abc06dfed27bf2cd3cebad98d07 Mon Sep 17 00:00:00 2001 From: sum2012 Date: Sun, 14 Aug 2022 14:54:06 +0800 Subject: [PATCH 2/5] Use compat.ini instead --- Core/Compatibility.cpp | 1 + Core/Compatibility.h | 1 + Core/Config.cpp | 1 - Core/Config.h | 1 - Core/HLE/sceAtrac.cpp | 3 ++- UI/GameSettingsScreen.cpp | 1 - assets/compat.ini | 23 +++++++++++++++++++++++ 7 files changed, 27 insertions(+), 4 deletions(-) diff --git a/Core/Compatibility.cpp b/Core/Compatibility.cpp index 984af5632b..c56cf702f8 100644 --- a/Core/Compatibility.cpp +++ b/Core/Compatibility.cpp @@ -96,6 +96,7 @@ void Compatibility::CheckSettings(IniFile &iniFile, const std::string &gameID) { CheckSetting(iniFile, gameID, "MaliDepthStencilBugWorkaround", &flags_.MaliDepthStencilBugWorkaround); CheckSetting(iniFile, gameID, "ZZT3SelectHack", &flags_.ZZT3SelectHack); CheckSetting(iniFile, gameID, "AllowLargeFBTextureOffsets", &flags_.AllowLargeFBTextureOffsets); + CheckSetting(iniFile, gameID, "AtracLoopHack", &flags_.AtracLoopHack); } void Compatibility::CheckSetting(IniFile &iniFile, const std::string &gameID, const char *option, bool *flag) { diff --git a/Core/Compatibility.h b/Core/Compatibility.h index 43dc651a23..c293fdfa17 100644 --- a/Core/Compatibility.h +++ b/Core/Compatibility.h @@ -86,6 +86,7 @@ struct CompatFlags { bool MaliDepthStencilBugWorkaround; bool ZZT3SelectHack; bool AllowLargeFBTextureOffsets; + bool AtracLoopHack; }; class IniFile; diff --git a/Core/Config.cpp b/Core/Config.cpp index 1cf2bde22a..91264ca5b4 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -956,7 +956,6 @@ static ConfigSetting soundSettings[] = { ConfigSetting("AltSpeedVolume", &g_Config.iAltSpeedVolume, -1, true, true), ConfigSetting("AudioDevice", &g_Config.sAudioDevice, "", true, false), ConfigSetting("AutoAudioDevice", &g_Config.bAutoAudioDevice, true, true, false), - ConfigSetting("HackSound", &g_Config.bHackSound, false, true, false), ConfigSetting(false), }; diff --git a/Core/Config.h b/Core/Config.h index 0939c89ed3..e682234ba3 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -256,7 +256,6 @@ public: bool bExtraAudioBuffering; // For bluetooth std::string sAudioDevice; bool bAutoAudioDevice; - bool bHackSound; // UI bool bShowDebuggerOnLoad; diff --git a/Core/HLE/sceAtrac.cpp b/Core/HLE/sceAtrac.cpp index 6a2c619842..6ee643fe5a 100644 --- a/Core/HLE/sceAtrac.cpp +++ b/Core/HLE/sceAtrac.cpp @@ -34,6 +34,7 @@ #include "Core/HLE/sceUtility.h" #include "Core/HLE/sceKernelMemory.h" #include "Core/HLE/sceAtrac.h" +#include "Core/System.h" // Notes about sceAtrac buffer management // @@ -1170,7 +1171,7 @@ static u32 sceAtracAddStreamData(int atracID, u32 bytesToAdd) { atrac->first_.offset += bytesToAdd; atrac->bufferValidBytes_ += bytesToAdd; - if (g_Config.bHackSound && atrac->bufferState_ == ATRAC_STATUS_STREAMED_LOOP_FROM_END && atrac->RemainingFrames() > 2) { // Code Lyoko don't like SeekToSample for unknown reason + if (PSP_CoreParameter().compat.flags().AtracLoopHack && atrac->bufferState_ == ATRAC_STATUS_STREAMED_LOOP_FROM_END && atrac->RemainingFrames() > 2) { atrac->loopNum_++; atrac->SeekToSample(atrac->loopStartSample_ - atrac->FirstOffsetExtra() - atrac->firstSampleOffset_); } diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 5b3cf71d5d..a21fcde46f 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -693,7 +693,6 @@ void GameSettingsScreen::CreateViews() { PopupMultiChoiceDynamic *MicChoice = audioSettings->Add(new PopupMultiChoiceDynamic(&g_Config.sMicDevice, a->T("Microphone Device"), micList, nullptr, screenManager())); MicChoice->OnChoice.Handle(this, &GameSettingsScreen::OnMicDeviceChange); } - audioSettings->Add(new CheckBox(&g_Config.bHackSound, a->T("Hack sound"))); // Control LinearLayout *controlsSettings = AddTab("GameSettingsControls", ms->T("Controls")); diff --git a/assets/compat.ini b/assets/compat.ini index 6f2e08c7b5..304cee3d5b 100644 --- a/assets/compat.ini +++ b/assets/compat.ini @@ -1240,3 +1240,26 @@ LBSW10345 = true # Some modded version found in our report logs ULES00928 = true ULUS10312 = true ULKS46154 = true + +[AtracLoopHack] +#Atrac looped incorrectly see #7601 #13773 #11586 ##10139 #12083 #12083 +Fix #12083 the Golf Rally fixed +#Coded Arms: Contagion +ULUS10184 = true +ULJM05243 = true +ULKS46139 = true + +#Gripshift +ULUS10040 = true +ULES00177 = true +ULKS46040 = true +ULJM05089 = true + +#Jackass the Game +ULUS10303 = true +ULES00897 = true + +#Shrek smash +ULUS10194 = true +ULES00618 = true + From ff1b933cf29822d0cfd488de36e8954eb330f32a Mon Sep 17 00:00:00 2001 From: sum2012 Date: Sun, 14 Aug 2022 14:58:15 +0800 Subject: [PATCH 3/5] oop --- assets/compat.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/compat.ini b/assets/compat.ini index 304cee3d5b..d7524ba4b0 100644 --- a/assets/compat.ini +++ b/assets/compat.ini @@ -1243,7 +1243,7 @@ ULKS46154 = true [AtracLoopHack] #Atrac looped incorrectly see #7601 #13773 #11586 ##10139 #12083 #12083 -Fix #12083 the Golf Rally fixed + #Coded Arms: Contagion ULUS10184 = true ULJM05243 = true From 1e96424ebf72f4e28c393e92e591980793bab192 Mon Sep 17 00:00:00 2001 From: sum2012 Date: Sun, 14 Aug 2022 15:29:38 +0800 Subject: [PATCH 4/5] oop --- assets/lang/en_US.ini | 1 - assets/lang/zh_CN.ini | 1 - assets/lang/zh_TW.ini | 1 - 3 files changed, 3 deletions(-) diff --git a/assets/lang/en_US.ini b/assets/lang/en_US.ini index b929cbe199..2d696f4ee4 100644 --- a/assets/lang/en_US.ini +++ b/assets/lang/en_US.ini @@ -33,7 +33,6 @@ Disabled = Disabled DSound (compatible) = DSound (compatible) Enable Sound = Enable sound Global volume = Global volume -Hack sound = Hack sound Microphone = Microphone Microphone Device = Microphone device Mute = Mute diff --git a/assets/lang/zh_CN.ini b/assets/lang/zh_CN.ini index 430f122c08..93ba6ebe35 100644 --- a/assets/lang/zh_CN.ini +++ b/assets/lang/zh_CN.ini @@ -9,7 +9,6 @@ Disabled = 禁用 DSound (compatible) = DirectSound(兼容) Enable Sound = 开启声音 Global volume = 全局音量 -Hack sound = 破解声音修复 Microphone = 麦克风 Microphone Device = 麦克风设备 Mute = 静音 diff --git a/assets/lang/zh_TW.ini b/assets/lang/zh_TW.ini index 5b55d4e293..86670da9e3 100644 --- a/assets/lang/zh_TW.ini +++ b/assets/lang/zh_TW.ini @@ -9,7 +9,6 @@ Disabled = Disabled DSound (compatible) = DirectSound(兼容) Enable Sound = 啟用音效 Global volume = 全局音量 -Hack sound = 破解聲音修復 Microphone = Microphone Microphone Device = 麥克風裝置 Mute = 靜音 From 2c04790a3237d0063d6f47b7901d58d8ec0c56c3 Mon Sep 17 00:00:00 2001 From: sum2012 Date: Sun, 14 Aug 2022 15:31:37 +0800 Subject: [PATCH 5/5] oop --- assets/compat.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/compat.ini b/assets/compat.ini index d7524ba4b0..005b5931e9 100644 --- a/assets/compat.ini +++ b/assets/compat.ini @@ -1242,7 +1242,7 @@ ULUS10312 = true ULKS46154 = true [AtracLoopHack] -#Atrac looped incorrectly see #7601 #13773 #11586 ##10139 #12083 #12083 +#Atrac looped incorrectly see #7601 #13773 #11586 #10139 #12083 #Coded Arms: Contagion ULUS10184 = true