• Advertisement
Sign in to follow this  

Losing some function pointers after bytecode reload

This topic is 1805 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I don't know where to start with this bug, so I'll just describe what happens.

I'm using the latest AS but it was like this a couple versions earlier too.

 

After I load byte code I get all sorts of errors.

Mainly I lose function pointers from the cache. I cache functions after loading like this:

 

cachedFuncs.func_onRender_CRules = mModule->GetFunctionByDecl( "void onRender( CRules@ this )" ); 

 

Now some functions lose the pointers and its just garbage. Not immediately but after some time before running the script.

But this is not the issue, its just an effect, cause if I dont use the cache there are some other random errors and crashes inside AS code.

 

I'm not 100% sure but I think the files I see breaking are the ones using an enum. It might be an AS bug not handling these enums properly:

 

this is the enum that is used in those files:

 

 

namespace Hitters {
shared enum hits{
hitter_nothing = 0,
 
//env
hitter_fall,
hitter_drown,
hitter_burn,
hitter_crush,
hitter_flying,
 
//common actor
hitter_stomp,
hitter_suicide,
 
//builders
hitter_hammer, //mason
hitter_saw, //carpenter
hitter_pick, //peasant
 
//arrows and similar projectiles
hitter_arrow,
hitter_ballista,
 
//cata
hitter_cata_stones,
 
//knight
hitter_sword,
hitter_shield,
hitter_bomb,
 
//siege
hitter_ram,
 
//traps
hitter_spikes,
 
//barbarian
hitter_muscles
};
}
 
 
its "shared" now but without shared it breaks too.

Share this post


Link to post
Share on other sites
Advertisement

It sounds like it might be a bug in AngelScript. Unfortunately I will need more information in order to reproduce the problem so I can identify and fix the bug.

 

Is it possible for you to write a smaller script that reproduces the problem? 

 

Can you identify what function in the script that causes the functions to become invalid? 

Share this post


Link to post
Share on other sites

I just made a fix that I think may be related to this problem that you reported. You can find the fix in revision 1555 + 1556.

 

I found this problem after discussing the problem that TheAtom reported here: http://www.gamedev.net/topic/638529-wrong-function-called-on-bytecode-restoration/

 

It would be great if you could try it out to see if this corrected your problem too.

 

[edit] additional fixes related to this problem

Edited by Andreas Jonsson

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement