Skip to content

Commit

Permalink
Restored legacy offset of CAudioStream::streamInternal
Browse files Browse the repository at this point in the history
  • Loading branch information
MiranDMC committed Oct 10, 2024
1 parent bfe0954 commit 9fe0226
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
9 changes: 8 additions & 1 deletion cleo_plugins/Audio/CAudioStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cleo_sdk/CLEO.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions source/CleoBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9fe0226

Please sign in to comment.