Having trouble loading deserializing

Having trouble loading deserializing

I'm back, sorry had some exams and only now I had time to apply the impressive information I've been given by havok_joe in my other threads.

I'm having an exception (cant really see the details, my visual studio crashes on exceptions idk why). The line with the exception is the last one(the callstack can barelly be seen before the crash). The exception is an access restriction at 0x00000000c. I expect this error to be due to some havok settings I might have missed (otherwise I dont know cause it's exactly like in the samples).

    hkLoader* m_loader = new hkLoader();
    hkStringBuf assetFile("models/HavokGirl/hkLowResSkin.hkx");
    hkRootLevelContainer* container = m_loader->load(assetFile.cString());
    _prototype = reinterpret_cast<hkaAnimationContainer*>( container->findObjectByType( hkaAnimationContainerClass.getName()));

8 Beiträge / 0 neu
Letzter Beitrag
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.
Bild des Benutzers havok_joe

Hi aresthegod:
http://software.intel.com/en-us/forums/topic/292298

Have you initialize the memory system before new a hkLoader?

It still looks like a memory problem.

Joe Developer Support Engineer Havok www.havok.com

Oh yes that is done, it's not why I'm posting this time. hkLoader initializes correctly this time. It's the last line of code wich returns an exception(well I guess the model wasnt deserialized as of yet). What can it be.
Again,

hkMemoryRouter* memoryRouter = hkMemoryInitUtil::initDefault( &baseMalloc, hkMemorySystem::FrameInfo(1024 * 1024) );
hkBaseSystem::init( memoryRouter, errorReport );

Was added before the initialization of hkLoader

Bild des Benutzers havok_joe

Hi aresthegod:

Have you seen any output in the command window? Can you add some assert to make sure the load is succeeded?
for example:
HK_ASSERT2(0x27343437, container != HK_NULL , "Could not load asset");
I think you've known you should add
#define HK_FEATURE_REFLECTION_ANIMATION
before
#include "Common/Base/Config/hkProductFeatures.cxx"
Right?
Cheers

Joe Developer Support Engineer Havok www.havok.com

I added the #define now I get privileged instruction exception @ the line: hkRootLevelContainer* container = m_loader->load(assetFile.cString());

Bild des Benutzers havok_joe

Hi;

Would you mind do some simple loading test ?
Use one of Havok Standalone StepbyStep Demo, for example: Demo\StandAloneDemos\StepByStep\Physics
and add some code to test loading the asset there.

//for loading model
#include <Common/Base/Container/String/hkStringBuf.h>
#include <Common/Serialize/Util/hkLoader.h>
#include <Common/Serialize/Util/hkRootLevelContainer.h>
#include <Animation/Animation/hkaAnimationContainer.h>
hkBaseSystem::init( memoryRouter, errorReport );

//test loading a model
{
	hkLoader* m_loader = new hkLoader();
	//make sure the asset is there
	hkStringBuf assetFile("../../../Demos/Resources/Animation/HavokGirl/hkLowResSkin_L4101.hkx");
	hkRootLevelContainer* container = m_loader->load(assetFile.cString());
	HK_ASSERT2(0x27343437, container != HK_NULL , "Could not load asset");

	hkaAnimationContainer* _prototype = reinterpret_cast( container->findObjectByType( hkaAnimationContainerClass.getName()));
	HK_ASSERT2(0x27343435, _prototype && (_prototype->m_skins.getSize() > 0), "No skins loaded");
}
// Keycode
#include <Common/Base/keycode.cxx>

// Productfeatures
#undef HK_FEATURE_PRODUCT_AI
//#undef HK_FEATURE_PRODUCT_ANIMATION
#undef HK_FEATURE_PRODUCT_CLOTH
#undef HK_FEATURE_PRODUCT_DESTRUCTION
#undef HK_FEATURE_PRODUCT_BEHAVIOR

//#define HK_EXCLUDE_FEATURE_SerializeDeprecatedPre700
//#define HK_EXCLUDE_FEATURE_RegisterVersionPatches
//#define HK_EXCLUDE_FEATURE_RegisterReflectedClasses
#define HK_EXCLUDE_FEATURE_MemoryTracker

#define HK_FEATURE_REFLECTION_ANIMATION

// This include generates an initialization function based on the products
// and the excluded features.
#include 

Add
hkaAnimation.lib
hkaInternal.lib
hkaRagdoll.lib
in Additional Dependencies, and then run it in FullDebug_Multithread Dll mode. Add a break point after initializing _prototype, if loading is OK, you can see _prototype->m_skin has value.

Let me know the result.

Thank you

Joe Developer Support Engineer Havok www.havok.com

While I've been having a pathing issue the error was yeah that hte container wasn't filled I apologise for not using HK_ASSERT earlier (and I also apologise my IDE is really messing up on breakpoints/exceptions and freezes out cant debug properly *visual studio*)

But now that it's not a pathing issue, m_loader->load() fails with illegal memory writing access exception.

For more info:
hkMallocAllocator baseMalloc;

hkMemoryRouter* memoryRouter = hkMemoryInitUtil::initDefault( &baseMalloc, hkMemorySystem::FrameInfo(1024 * 1024) );
hkBaseSystem::init( memoryRouter, errorReport );

This is being executed right before the deserializing process.

Bild des Benutzers havok_joe

Hi arresthegod:

It looks quite weird for me. So, can you run any of Havok standalone demo (in step by step) ? Can you try to follow my 09/07 reply and test it out?

If it still does not work, would you mind attach your source code and I can have a look.

By the way, which visual studio you are using ? Maybe I can try to create a very simple loading sample for you.

Cheers

Joe Developer Support Engineer Havok www.havok.com

Melden Sie sich an, um einen Kommentar zu hinterlassen.