samp-re/common.c

162 lines
2.4 KiB
C
Raw Normal View History

/* vim: set filetype=c ts=8 noexpandtab: */
#include "common.h"
__declspec(naked)
void * __stdcall Queue_AtPosition_QWORD(struct CQueue *queue, int position)
{
_asm {
pop eax
pop ecx
push eax
mov eax, 0x45B690
jmp eax
}
}
__declspec(naked)
void __stdcall Queue_Push_QWORD(struct CQueue *queue, void *value)
{
_asm {
pop eax
pop ecx
push eax
mov eax, 0x45B5B0
jmp eax
}
}
/**
@param value a POINTER to the value (so for a queue of pointers, a **value)
*/
__declspec(naked)
void __stdcall Queue_Push_DWORD(struct CQueue *queue, void *value)
{
_asm {
pop eax
pop ecx
push eax
mov eax, 0x450FA0
jmp eax
}
}
2020-04-05 16:19:05 +02:00
__declspec(naked)
void * __stdcall thiscall0(void *address, void *this)
{
_asm {
add esp, 0xC
mov ecx, [esp-0x4]
mov eax, [esp-0x8]
push [esp-0xC]
jmp eax
}
}
__declspec(naked)
void * __stdcall thiscall1(void *address, void *this, int a)
{
_asm {
add esp, 0xC
mov ecx, [esp-0x4]
mov eax, [esp-0x8]
push [esp-0xC]
jmp eax
}
}
__declspec(naked)
void * __stdcall thiscall2(void *address, void *this, int a, int b)
{
_asm {
add esp, 0xC
mov ecx, [esp-0x4]
mov eax, [esp-0x8]
push [esp-0xC]
jmp eax
}
}
__declspec(naked)
void * __stdcall thiscall3(void *address, void *this, int a, int b, int c)
{
_asm {
add esp, 0xC
mov ecx, [esp-0x4]
mov eax, [esp-0x8]
push [esp-0xC]
jmp eax
}
}
__declspec(naked)
void * __stdcall thiscall4(void *address, void *this,
int a, int b, int c, int d)
{
_asm {
add esp, 0xC
mov ecx, [esp-0x4]
mov eax, [esp-0x8]
push [esp-0xC]
jmp eax
}
}
__declspec(naked)
void __stdcall RangeList__ctor(struct CRangeList *this)
{
_asm {
pop eax
pop ecx
push eax
mov eax, 0x45F2D0
jmp eax
}
}
__declspec(naked)
void __stdcall RangeList__dtor(struct CRangeList *this)
{
_asm {
pop eax
pop ecx
push eax
mov eax, 0x45F300
jmp eax
}
}
__declspec(naked)
int __stdcall BPlusTree__IsEmpty(void *this)
{
_asm {
pop eax
pop ecx
push eax
mov eax, 0x45B570
jmp eax
}
}
void RaknetTimeNS_Add(struct CRaknetTimeNS *this, unsigned int value)
{
unsigned int oldLo;
oldLo = this->lo32;
this->lo32 += value;
if (this->lo32 < oldLo) {
this->hi32++;
}
}
int RaknetTimeNS_IsBigger(
struct CRaknetTimeNS isbigger,
struct CRaknetTimeNS than)
{
if (isbigger.hi32 > than.hi32) {
return 1;
}
return isbigger.hi32 == than.hi32 && isbigger.lo32 > than.lo32;
}