[Plugin] Squirrel in SA:MP
#19

Quote:
Originally Posted by ******
Посмотреть сообщение
Some of the code in there looks a lot like the code from YSF - given the number of times you mentioned it I assume you know about it. Anyway, my point is that YSF has both Windows and Linux code and can call into the server properly (although the addresses need updating).

I have also removed a large amount of inline ASM and replaced it with standard C as they removed inline assembly in the 64bit version of the Visual Studio compiler. For some bizzare reason my server is not responding at the moment, but when it's back I suggest you have a look at how I do it. For example the C++ code to call a random address as an object method is something like:

Код:
*((CClass *)RANDOM_VARIABLE).(*METHOD_ADDRESS)(parameters);
I can't remember the exact code, but the point is you don't need inline assembly and there is already code in YSF (also released under the MPL so you can safely mix it) to do it for Windows and Linux.

Edit: I found the information: http://mdzahidh.wordpress.com/2008/0...thod-pointers/

The way I did it, as you don't really have the class data, is to define a fake class like so:

Код:
class CFake
{
}

typedef
	int (CFake::*ZeroParMethod_t)();

// Actually - casting to a method pointer is not quite this easy.
ZeroParMethod_t
	On‌GameModeInit = (ZeroParMethod_t)0x0045E360;

CFake *
	pGameMode = *(CFake **)0xFFFFFFFF;
Calling a method anywhere in the server is then as easy as:

Код:
(pGameMode->*OnGameModeInit)();
your epic words.. i got lost at "some"
Reply


Messages In This Thread
Squirrel in SA:MP - by Toribio - 12.08.2010, 23:15
Re: Squirrel in SA:MP - by giovanni94m - 12.08.2010, 23:22
Re: Squirrel in SA:MP - by Toribio - 12.08.2010, 23:47
Re: Squirrel in SA:MP - by joemomma53 - 12.08.2010, 23:49
Re: Squirrel in SA:MP - by Toribio - 12.08.2010, 23:55
Re: Squirrel in SA:MP - by Zeex - 13.08.2010, 01:36
Re: Squirrel in SA:MP - by Toribio - 13.08.2010, 01:43
Re: Squirrel in SA:MP - by Zeex - 13.08.2010, 01:51
Re: Squirrel in SA:MP - by Toribio - 13.08.2010, 01:56
Re: Squirrel in SA:MP - by joemomma53 - 13.08.2010, 02:10
Re: Squirrel in SA:MP - by Calgon - 13.08.2010, 10:43
Re: Squirrel in SA:MP - by Toribio - 13.08.2010, 16:56
Re: Squirrel in SA:MP - by Toni - 13.08.2010, 17:29
Re: Squirrel in SA:MP - by Toribio - 13.08.2010, 17:49
Re: Squirrel in SA:MP - by Souvlaki - 14.08.2010, 17:21
Re: Squirrel in SA:MP - by hencz - 14.08.2010, 20:05
Re: Squirrel in SA:MP - by [SF]RobMob - 18.08.2010, 22:37
Re: Squirrel in SA:MP - by iLinx - 18.08.2010, 22:51
Re: Squirrel in SA:MP - by DiddyBop - 19.08.2010, 03:04
Re: Squirrel in SA:MP - by [ESC]Walter_Wolf - 25.02.2014, 07:30
Re: Squirrel in SA:MP - by VIRUXE - 25.02.2014, 17:51
Re: Squirrel in SA:MP - by ManGoe - 27.04.2014, 10:15
Re: Squirrel in SA:MP - by GWMPT - 27.04.2014, 10:57

Forum Jump:


Users browsing this thread: 1 Guest(s)