From 9fe022673af912c9c8530611805a4e7ef51dc04e Mon Sep 17 00:00:00 2001 From: Miran Date: Fri, 11 Oct 2024 00:05:43 +0200 Subject: [PATCH] Restored legacy offset of CAudioStream::streamInternal --- cleo_plugins/Audio/CAudioStream.h | 9 ++++++++- cleo_sdk/CLEO.h | 2 +- source/CleoBase.cpp | 4 ++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/cleo_plugins/Audio/CAudioStream.h b/cleo_plugins/Audio/CAudioStream.h index fdfa2b60..f43a957f 100644 --- a/cleo_plugins/Audio/CAudioStream.h +++ b/cleo_plugins/Audio/CAudioStream.h @@ -5,7 +5,14 @@ namespace CLEO { - class CAudioStream + // in CLEO4 CAudioStream was extending VInjectible + // this dummy parent keeps offset of CAudioStream::streamInternal unchanged + class Dummy + { + virtual void dummy() {}; + }; + + class CAudioStream : Dummy { public: enum eStreamState diff --git a/cleo_sdk/CLEO.h b/cleo_sdk/CLEO.h index 1a1d3c83..a73a328f 100644 --- a/cleo_sdk/CLEO.h +++ b/cleo_sdk/CLEO.h @@ -530,7 +530,7 @@ void WINAPI CLEO_RemoveScriptDeleteDelegate(FuncScriptDeleteDelegateT func); DWORD WINAPI CLEO_GetScriptTextureById(CRunningScript* thread, int id); // ret RwTexture * -DWORD WINAPI CLEO_GetInternalAudioStream(CRunningScript* thread, DWORD stream); // arg CAudioStream * +DWORD WINAPI CLEO_GetInternalAudioStream(CRunningScript* unused, DWORD audioStreamPtr); // CAudioStream* struct StringList { DWORD count; char** strings; }; void WINAPI CLEO_StringListFree(StringList list); // releases resources used by StringList container diff --git a/source/CleoBase.cpp b/source/CleoBase.cpp index a532b2af..334f82a0 100644 --- a/source/CleoBase.cpp +++ b/source/CleoBase.cpp @@ -252,9 +252,9 @@ namespace CLEO GetInstance().RemoveCallback(id, func); } - DWORD WINAPI CLEO_GetInternalAudioStream(CLEO::CRunningScript* thread, DWORD stream) // arg CAudioStream * + DWORD WINAPI CLEO_GetInternalAudioStream(CLEO::CRunningScript* unused, DWORD audioStreamPtr) { - return stream; // CAudioStream::streamInternal offset is 0 + return audioStreamPtr + 0x8; // offsetof(CAudioStream, streamInternal) } void WINAPI CLEO_ResolvePath(CLEO::CRunningScript* thread, char* inOutPath, DWORD pathMaxLen)