Raised This Month: $12 Target: $400
 3% 

Problem porting to OB


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Keeper
Senior Member
Join Date: Nov 2006
Old 10-03-2010 , 10:49   Problem porting to OB
Reply With Quote #1

My plugin for HL2DM needs to be ported.

When I got all of the nit picky things changed, I'm getting this error on compiling:

Code:
SH_DECL_MANUALHOOK0(GetBulletSpread_hook, 0, 0, 0, Vector const& );

1>C:\plugins\sourcemm_sdk\core\sourcehook\sourcehook.h(6743) : error C2528: 'abstract declarator' : pointer to reference is illegal
1>        ..\main.cpp(85) : see reference to function template instantiation 'void SourceHook::SetOverrideResult<__SourceHook_MFHCls_GetBulletSpread_hook::RetType>(SourceHook::ISourceHook *,RetType)' being compiled
1>        with
1>        [
1>            RetType=__SourceHook_MFHCls_GetBulletSpread_hook::RetType
1>        ]
1>C:\plugins\sourcemm_sdk\core\sourcehook\sourcehook.h(6743) : error C2678: binary '=' : no operator found which takes a left-hand operand of type '__SourceHook_MFHCls_GetBulletSpread_hook::RetType ' (or there is no acceptable conversion)
1>        c:\plugins\source-sdks\ob\public\mathlib/vector.h(168): could be 'Vector &Vector::operator =(const Vector &)'
1>        while trying to match the argument list '(__SourceHook_MFHCls_GetBulletSpread_hook::RetType , const Vector)'
If I remove this hook ( which is probably not needed ), it compiles fine. I just want to know if I'm doing something wrong, or what the issue is.
Keeper is offline
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 10-03-2010 , 16:48   Re: Problem porting to OB
Reply With Quote #2

Hello,

Hrm. On the first glance, this looks like a bug in SourceHook. It looks like reference returns are not supported with manual hooks at the moment.

The reason is that a special class has to be utilized which encapuslates the return type when it's a reference and internally stores it as a pointer. Apparently this is done for normal hooks but not for manual hooks. I hope I just forgot to do it and there's not a bigger problem

I will try to fix this ASAP.

Greetings, PM.
__________________
hello, i am pm
PM is offline
Keeper
Senior Member
Join Date: Nov 2006
Old 10-03-2010 , 16:56   Re: Problem porting to OB
Reply With Quote #3

Ok, thanks!

This did work in EP1 games ( core-legacy ). Was it just maybe not brought over?
Keeper is offline
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 10-03-2010 , 17:57   Re: Problem porting to OB
Reply With Quote #4

Actually, the situation is likely to be more complicated than that.

My current understanding from reading the code is:

Somewhen, the feature of declaring "extern manual hooks" was added (ie. declaring a manual hook in one compilation unit and using it in another).
Until then, the macro RETURN_META_VALUE_MNEWPARAMS used to access something declared in SH_DECL_MANUALHOOK. This was not possible anymore, so a new function was added in SH_DECL_MANUALHOOK which did that part and RETURN_META_VALUE_MNEWPARAMS now only needs to call that function.

The side effect is that that function is now always compiled and not only when someone does RETURN_META_VALUE_MNEWPARAMS.

It turns out that what the function does ( = what RETURN_META_VALUE_MNEWPARAMS used to do there too ) is not compatible with reference return types.

This means that this functionality was already broken, but nobody has noticed, because nobody has used RETURN_META_VALUE_MNEWPARAMS with a manual hook which has a reference return type. Or nobody has reported it or I haven't read the report And now with that 'exeternal manual hook declaration' feature the broken part is reported by the compiler as soon as you declare the hook.

I have a potential fix on my hard disk (only involves changes in sourcehook.h) but have to add some more test cases before I send it to (unsigned long) 0xBA1L so I guess it'll be finished in the next few days.

If you are actively using that hook and need to test it earlier please send me a PM.

Greetings,
PM

Edit: Actually, why so complicated, here is the new sourcehook.h in case you wish to try it out. Beware: only tried on windows so far!
Attached Files
File Type: zip sourcehook_h.zip (26.3 KB, 77 views)
__________________
hello, i am pm

Last edited by PM; 10-03-2010 at 18:24. Reason: Attachement
PM is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:32.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode