Skip to content

Commit

Permalink
Bug fixes:
Browse files Browse the repository at this point in the history
- GetSDLWindowHandle() didn't call SDL_GetWindowWMInfo() correctly
- FindObjectAndCreateVisualizer() were called from main() with wrong arguments, so
  2nd loaded object was displayed first
- CUmodelApp::Draw3D() was crashed when displayed dummy object visualizer
- sdl.dll was recompiled with pdb
- CTextureData: more correct work with CompressedData/ShouldFreeData
  - using appMalloc/appFree for all allocations instead of mix appMalloc/delete etc
  - ShouldFreeData was set even when data was not set (for example, if FindBioTexture
    returned NULL)

Other:
- placed package loader creating code to UnPackage::CreateLoader()
- added typeinfo for FArchive, plus some kind of "dynamic_cast"


git-svn-id: svn://localhost@220 a3f5f06f-15b6-264c-8744-b656ee826ca1
  • Loading branch information
gildor2 committed Sep 15, 2014
1 parent 8cc0dc3 commit 37436e8
Show file tree
Hide file tree
Showing 11 changed files with 176 additions and 86 deletions.
2 changes: 2 additions & 0 deletions Docs/todo.!!!
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ ERROR: Package "StaticMeshes/DanielsMeshes.usx": wrong name index 178111707
UnPackage::SerializeFName:pos=0000010A <- FPropertyTag<< <- CTypeInfo::SerializeProps <- ReadProperty:(UStaticMesh.Materials, TagPos=FA) <- CTypeInfo::SerializeProps <- UObject::Serialize <- UPrimitive::Serialize <- UStaticMesh::Serialize <- LoadObject:StaticMesh'DanielsMeshes.ball', pos=10A, ver=115/0, game=2000 <- UObject::EndLoad <- LoadWholePackage:DanielsMeshes <- Main
=end=

*SITE* compatibility table: "filter" is misaligned in Opera

- SDL: 1.3 -> 2.0 (win+lin)
- B&S RLE Anim: check this
https://sites.google.com/site/sippeyfunlabs/blade-and-soul-a-unreal-3-based-game-mod-section
Expand Down
7 changes: 4 additions & 3 deletions Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,7 @@ static HWND GetSDLWindowHandle(SDL_Window* window)
if (!window) return 0;

SDL_SysWMinfo info;
SDL_VERSION(&info.version);
SDL_GetWindowWMInfo(window, &info);
return info.info.win.window;
}
Expand Down Expand Up @@ -1294,7 +1295,7 @@ int main(int argc, char **argv)
}

// find any object to display
if (!FindObjectAndCreateVisualizer(1, false, guiShown))
if (!FindObjectAndCreateVisualizer(1, guiShown, true))
{
appPrintf("\nThe specified package(s) has no objects to diaplay.\n\n");
goto no_objects;
Expand Down Expand Up @@ -1478,7 +1479,7 @@ static int GDoScreenshot = 0;

void CUmodelApp::Draw3D(float TimeDelta)
{
UObject *Obj = UObject::GObjObjects[ObjIndex];
UObject *Obj = (ObjIndex < UObject::GObjObjects.Num()) ? UObject::GObjObjects[ObjIndex] : NULL;

guard(CUmodelApp::Draw3D);

Expand All @@ -1500,7 +1501,7 @@ void CUmodelApp::Draw3D(float TimeDelta)
GDoScreenshot = 0;
}

unguardf("Obj=%s'%s'", Obj->GetClassName(), Obj->Name);
unguardf("Obj=%s'%s'", Obj ? Obj->GetClassName() : "None", Obj ? Obj->Name : "None");
}


Expand Down
Binary file modified SDL.dll
Binary file not shown.
37 changes: 37 additions & 0 deletions Unreal/UnCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,40 @@ class FArchive
{
return *this;
}

// some typeinfo

static const char* StaticGetName()
{
return "FArchive";
}

virtual const char* GetName() const
{
return StaticGetName();
}

template<class T> T* CastTo()
{
if (!strcmp(GetName(), T::StaticGetName()))
return (T*)this;
else
return NULL;
}
};

#define DECLARE_ARCHIVE(Name) \
public: \
static const char* StaticGetName() \
{ \
return #Name; \
} \
virtual const char* GetName() const \
{ \
return StaticGetName(); \
} \
private:


// Note: bools in UE are usually serialized as int32
FORCEINLINE FArchive& operator<<(FArchive &Ar, bool &B)
Expand Down Expand Up @@ -475,6 +507,7 @@ enum EFileReaderOptions

class FFileArchive : public FArchive
{
DECLARE_ARCHIVE(FFileArchive);
public:
FFileArchive(const char *Filename, unsigned InOptions)
{
Expand Down Expand Up @@ -569,6 +602,7 @@ inline bool appFileExists(const char* filename)

class FFileReader : public FFileArchive
{
DECLARE_ARCHIVE(FFileReader);
public:
FFileReader(const char *Filename, unsigned InOptions = 0)
: FFileArchive(Filename, Options)
Expand Down Expand Up @@ -607,6 +641,7 @@ class FFileReader : public FFileArchive

class FFileWriter : public FFileArchive
{
DECLARE_ARCHIVE(FFileWriter);
public:
FFileWriter(const char *Filename, unsigned Options = 0)
: FFileArchive(Filename, Options)
Expand Down Expand Up @@ -642,6 +677,7 @@ class FFileWriter : public FFileArchive

class FReaderWrapper : public FArchive
{
DECLARE_ARCHIVE(FReaderWrapper);
public:
FArchive *Reader;
int ArPosOffset;
Expand Down Expand Up @@ -679,6 +715,7 @@ class FReaderWrapper : public FArchive

class FMemReader : public FArchive
{
DECLARE_ARCHIVE(FMemReader);
public:
FMemReader(const void *data, int size)
: DataPtr((const byte*)data)
Expand Down
10 changes: 9 additions & 1 deletion Unreal/UnMaterial.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,17 @@ struct CTextureData
memset(this, 0, sizeof(CTextureData));
}
~CTextureData()
{
ReleaseCompressedData();
}
void ReleaseCompressedData()
{
if (ShouldFreeData && CompressedData)
delete const_cast<byte*>(CompressedData);
{
appFree(const_cast<byte*>(CompressedData));
ShouldFreeData = false;
CompressedData = NULL;
}
}

unsigned GetFourCC() const;
Expand Down
Loading

0 comments on commit 37436e8

Please sign in to comment.