Skip to content

Commit

Permalink
fixup! Restored legacy offset of CAudioStream::streamInternal
Browse files Browse the repository at this point in the history
  • Loading branch information
MiranDMC committed Oct 11, 2024
1 parent 9fe0226 commit b083a18
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions cleo_plugins/Audio/C3DAudioStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ using namespace CLEO;

C3DAudioStream::C3DAudioStream(const char* filepath) : CAudioStream()
{
constexpr auto offset = offsetof(C3DAudioStream, streamInternal);
static_assert(offset == 4, "C3DAudioStream compatibility with CLEO4 broken!");

if (isNetworkSource(filepath) && !CSoundSystem::allowNetworkSources)
{
TRACE("Loading of 3d-audiostream '%s' failed. Support of network sources was disabled in SA.Audio.ini", filepath);
Expand Down
3 changes: 3 additions & 0 deletions cleo_plugins/Audio/CAudioStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ using namespace CLEO;

CAudioStream::CAudioStream(const char* filepath)
{
constexpr auto offset = offsetof(CAudioStream, streamInternal);
static_assert(offset == 4, "CAudioStream compatibility with CLEO4 broken!");

if (isNetworkSource(filepath) && !CSoundSystem::allowNetworkSources)
{
TRACE("Loading of audiostream '%s' failed. Support of network sources was disabled in SA.Audio.ini", filepath);
Expand Down
2 changes: 1 addition & 1 deletion source/CleoBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ namespace CLEO

DWORD WINAPI CLEO_GetInternalAudioStream(CLEO::CRunningScript* unused, DWORD audioStreamPtr)
{
return audioStreamPtr + 0x8; // offsetof(CAudioStream, streamInternal)
return audioStreamPtr + 0x4; // offsetof(CAudioStream, streamInternal)
}

void WINAPI CLEO_ResolvePath(CLEO::CRunningScript* thread, char* inOutPath, DWORD pathMaxLen)
Expand Down

0 comments on commit b083a18

Please sign in to comment.