Skip to content

Commit

Permalink
- create stubs required for ZDoom/gzdoom#2514
Browse files Browse the repository at this point in the history
  • Loading branch information
madame-rachelle committed Apr 20, 2024
1 parent accab2a commit df3b193
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 7 deletions.
3 changes: 1 addition & 2 deletions source/common/audio/sound/s_sound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -749,9 +749,8 @@ sfxinfo_t *SoundEngine::LoadSound(sfxinfo_t *sfx)
{
auto sfxp = sfxdata.data();
int32_t dmxlen = LittleLong(((int32_t *)sfxp)[1]);

// If the sound is voc, use the custom loader.
if (memcmp (sfxp, "Creative Voice File", 19) == 0)
if (size > 19 && memcmp (sfxp, "Creative Voice File", 19) == 0)
{
sfx->data = GSnd->LoadSoundVoc(sfxp, size);
}
Expand Down
2 changes: 1 addition & 1 deletion source/common/filesystem/source/file_directory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ int FDirectory::AddDirectory(const char *dirpath, LumpFilterInfo* filter, FileSy
// On Linux this is important because its file system is case sensitive,
// but even on Windows the Unicode normalization is destructive
// for some characters and cannot be used for file names.
// Examples for this are the Turkish 'i's or the German ß.
// Examples for this are the Turkish 'i's or the German ß.
SystemFilePath[count] = stringpool->Strdup(entry.FilePathRel.c_str());
// for internal access we use the normalized form of the relative path.
// this is fine because the paths that get compared against this will also be normalized.
Expand Down
12 changes: 10 additions & 2 deletions source/common/objects/dobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ void DObject::Release()

void DObject::Destroy ()
{
RemoveFromNetwork();

// We cannot call the VM during shutdown because all the needed data has been or is in the process of being deleted.
if (PClass::bVMOperational)
{
Expand Down Expand Up @@ -569,8 +571,15 @@ void DObject::Serialize(FSerializer &arc)

SerializeFlag("justspawned", OF_JustSpawned);
SerializeFlag("spawned", OF_Spawned);

SerializeFlag("networked", OF_Networked);

ObjectFlags |= OF_SerialSuccess;

if (arc.isReading() && (ObjectFlags & OF_Networked))
{
ClearNetworkID();
EnableNetworking(true);
}
}

void DObject::CheckIfSerialized () const
Expand All @@ -585,7 +594,6 @@ void DObject::CheckIfSerialized () const
}
}


DEFINE_ACTION_FUNCTION(DObject, MSTime)
{
ACTION_RETURN_INT((uint32_t)I_msTime());
Expand Down
12 changes: 12 additions & 0 deletions source/common/objects/dobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,18 @@ class DObject
friend T* Create(Args&&... args);

friend class JitCompiler;

private:
// This is intentionally left unserialized.
uint32_t _networkID;

public:
inline bool IsNetworked() const { return (ObjectFlags & OF_Networked); }
inline uint32_t GetNetworkID() const { return _networkID; }
void SetNetworkID(const uint32_t id);
void ClearNetworkID();
void RemoveFromNetwork();
virtual void EnableNetworking(const bool enable);
};

// This is the only method aside from calling CreateNew that should be used for creating DObjects
Expand Down
1 change: 1 addition & 0 deletions source/common/objects/dobjgc.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ enum EObjectFlags
OF_Transient = 1 << 11, // Object should not be archived (references to it will be nulled on disk)
OF_Spawned = 1 << 12, // Thinker was spawned at all (some thinkers get deleted before spawning)
OF_Released = 1 << 13, // Object was released from the GC system and should not be processed by GC function
OF_Networked = 1 << 14, // Object has a unique network identifier that makes it synchronizable between all clients.
};

template<class T> class TObjPtr;
Expand Down
18 changes: 16 additions & 2 deletions source/core/vmstubs.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
#include "common/engine/palettecontainer.h"
#include "name.h"
#include "dobject.h"

bool ShouldAllowGameSpecificVirtual(FName name, unsigned index, PType* arg, PType* varg)
{
return false;
return false;
}

void DObject::EnableNetworking(const bool enable)
{
return;
}

void DObject::RemoveFromNetwork(void)
{
return;
}

void DObject::ClearNetworkID()
{
return;
}

0 comments on commit df3b193

Please sign in to comment.