Esempio n. 1
0
uintptr_t searchInGameChatWhat()
{
	//=========================================
	// (1)
	//
	//  mov     ecx, "InGameChatWhat" 
	//  call    sub_6F3304C0
	//  ds:flt_6F946378
	//  mov     eax, [esi+98h]
	//  movzx   edx, byte ptr [esi+15h]
	//  push    ecx             ; txtTime
	//  lea     ecx, [esp+114h+text]
	//  fstp    [esp+114h+var_114]
	//  push    eax             ; ctype
	//  push    ecx             ; text
	//  push    edx             ; PlayerID
	//  mov     ecx, ebx        ; this
	//  call    InGameChatWhat                  <----
	//=========================================
	uintptr_t ptr = get_war3_searcher().search_string("InGameChatWhat");
	ptr += 0x04;
	ptr = next_opcode(ptr, 0xE8, 5);
	ptr += 0x05;
	ptr = next_opcode(ptr, 0xE8, 5);
	return convert_function(ptr);
}
Esempio n. 2
0
void _cdecl FakeSetUnitState(uint32_t unit_handle, uint32_t state_type, uint32_t* value_ptr)
{
	switch (state_type)
	{
	case UNIT_STATE_DAMAGE_DICE:
	case UNIT_STATE_DAMAGE_SIDE:
	case UNIT_STATE_DAMAGE_BASE:
	case UNIT_STATE_DAMAGE_BONUS:
	case UNIT_STATE_DAMAGE_MIN:
	case UNIT_STATE_DAMAGE_MAX:
	case UNIT_STATE_DAMAGE_RANGE:
	case UNIT_STATE_ARMOR:
		break;
	default:
		aero::c_call<void>(RealSetUnitState, unit_handle, state_type, value_ptr);
		return;
	}

	war3_searcher&s = get_war3_searcher();
	uintptr_t unit_object = s.unit_handle_to_object(unit_handle);
	if (!unit_object)
	{
		return ;
	}

	if (state_type == UNIT_STATE_ARMOR)
	{
		*(uint32_t*)(unit_object + 0xE0) = *value_ptr;
		return ;
	}

	unit_property* ptr = (unit_property*)*(uintptr_t*)(unit_object + 0x1E4 + (s.get_version() > version_124c ? 4: 0));
	if (!ptr)
	{
		return ;
	}

	switch (state_type)
	{
	case UNIT_STATE_DAMAGE_DICE:
		ptr->damage_dice = (uint32_t)jass::from_real(*value_ptr);
		return ;
	case UNIT_STATE_DAMAGE_SIDE:
		ptr->damage_side = (uint32_t)jass::from_real(*value_ptr);
		return ;
	case UNIT_STATE_DAMAGE_BASE:
		ptr->damage_base = (uint32_t)jass::from_real(*value_ptr);
		return ;
	case UNIT_STATE_DAMAGE_BONUS:
		ptr->damage_bonus = (uint32_t)jass::from_real(*value_ptr);
		return ;
	case UNIT_STATE_DAMAGE_RANGE:
		ptr->damage_ranage = *value_ptr;
		return ;
	case UNIT_STATE_DAMAGE_MIN:
	case UNIT_STATE_DAMAGE_MAX:
	default:
		return ;
	}
}
Esempio n. 3
0
	static uintptr_t game_war3()
	{
		war3_searcher& s = get_war3_searcher();
		uintptr_t ptr = s.get_instance(0x0D);
		ptr = *(uintptr_t*)(ptr + 0x10);
		ptr = *(uintptr_t*)(ptr + 0x18);
		return ptr;
	}
Esempio n. 4
0
File: jass.cpp Progetto: hjhong/YDWE
	uintptr_t search_create_string()
	{
		uintptr_t ptr = get_war3_searcher().search_string("I2S");
		ptr = *(uintptr_t*)(ptr + 0x05);
		ptr = next_opcode(ptr, 0xE8, 5);
		ptr += 0x05;
		ptr = next_opcode(ptr, 0xE8, 5);
		return convert_function(ptr);
	}
Esempio n. 5
0
	uintptr_t get_random_seed()
	{
		war3_searcher& s = get_war3_searcher();
		uintptr_t ptr = s.search_string("SetRandomSeed");
		ptr = *(uintptr_t*)(ptr + 0x05);
		ptr = next_opcode(ptr, 0x8B, 6);
		ptr = *(uintptr_t*)(ptr + 2);
		return *(uintptr_t*)(*(uintptr_t*)(ptr)+4);
	}
Esempio n. 6
0
	jass_vm_t* get_jass_thread()
	{
		uintptr_t ptr = get_war3_searcher().get_instance(5);
		uint32_t index = *(uintptr_t*)(ptr + 0x14);
		if (index == 0) {
			return 0;
		}
		return *(jass_vm_t**)(*(uintptr_t*)(ptr + 0x0C) + 4 * index - 4);
	}
Esempio n. 7
0
void __cdecl EXDisplayChat(uint32_t player_handle, uint32_t chat_recipient, uint32_t message)
{
	static uintptr_t InGameChatWhat = searchInGameChatWhat();

	uint32_t CGameUI = get_war3_searcher().get_gameui(0, 0);
	if (CGameUI != 0)
	{
		this_call<void>(InGameChatWhat, CGameUI, jass::call("GetPlayerId", player_handle), jass::from_trigstring(jass::from_string(message)), chat_recipient, (float)10.0f);
	}
}
Esempio n. 8
0
uintptr_t search_jass_vmmain()
{
    war3_searcher& s = get_war3_searcher();
    uintptr_t ptr = 0;

    //=========================================
    //  (1)
    //
    //    push    493E0h
    //    push    1
    //    push    1
    //    push    0
    //    mov     edx, offset s_Config ; "config"
    //    mov     ecx, esi
    //    call    UnknowFunc  <----
    //=========================================
    ptr = s.search_string("config");
    ptr += sizeof uintptr_t;
    ptr = next_opcode(ptr, 0xE8, 5);
    ptr = convert_function(ptr);
    //=========================================
    //  (2)
    //
    //  UnknowFunc:
    //    push    esi
    //    mov     esi, edx
    //    call    GetVMInstance
    //    cmp     [esp+4+arg_8], 0
    //    mov     ecx, eax
    //    jz      short loc_6F44C170
    //    cmp     dword ptr [ecx+20h], 0
    //    jz      short loc_6F44C170
    //    call    UnknowFunc2         <----
    //=========================================
    ptr = next_opcode(ptr, 0xE8, 5);
    ptr += 5;
    ptr = next_opcode(ptr, 0xE8, 5);
    ptr = convert_function(ptr);
    //=========================================
    //  (3)
    //
    //  UnknowFunc2:
    //    mov     eax, [ecx+20h]
    //    push    0
    //    push    493E0h
    //    push    0
    //    push    eax
    //    call    JassVMMain    <----
    //    retn
    //=========================================
    ptr = next_opcode(ptr, 0xE8, 5);
    ptr = convert_function(ptr);
    return ptr;
}
Esempio n. 9
0
File: jass.cpp Progetto: hjhong/YDWE
			static trigstring_table* get()
			{
				uintptr_t ptr = get_war3_searcher().get_instance(13);
				if (ptr)
				{
					ptr = *(uintptr_t*)(*(uintptr_t*)(ptr + 16) + 24);
					if (ptr)
					{
						return (trigstring_table*)*(uintptr_t*)(ptr + 1004);
					}
				}

				return nullptr;
			}
Esempio n. 10
0
		static mapping initialize_from_register()
		{
			mapping m;

			uintptr_t ptr_Deg2Rad = get_war3_searcher().search_string("Deg2Rad");
			if (ptr_Deg2Rad)
			{
				for (detail::asm_register_native_function* ptr = (detail::asm_register_native_function*)(ptr_Deg2Rad - 6); ptr->verify(); ++ptr)
				{
					m.insert(std::make_pair(ptr->get_name(), func_value(ptr->get_param(), ptr->get_address())));
				}
			}

			return std::move(m);
		}
Esempio n. 11
0
	static uintptr_t search()
	{
		war3_searcher& s = get_war3_searcher();
		if (s.get_version() == version_120e)
		{
			return s.base() + 0x0070CD34;
		}
		else if (s.get_version() < version_127a)
		{
			uintptr_t ptr = s.search_string_ptr("QuickSave", sizeof("QuickSave"));
			ptr += 0x44;
			return ptr;
		}
		uintptr_t ptr = s.search_string_ptr("d:\\buildserver\\3\\work-git\\warcraft3-repository\\war3\\source\\ui\\CMultiboard.h", sizeof("d:\\buildserver\\3\\work-git\\warcraft3-repository\\war3\\source\\ui\\CMultiboard.h"));
		ptr += 0x80;
		return ptr;
	}
Esempio n. 12
0
	jass_vm_t* get_jass_vm(int index)
	{
		uintptr_t ptr = get_war3_searcher().get_instance(5);
		uintptr_t vm = *(uintptr_t*)(*(uintptr_t*)(ptr + 0x90) + 0x04 * index);
		return vm ? (jass_vm_t*)(vm - ((get_war3_searcher().get_version() > version_120e) ? 0 : 4)) : nullptr;
	}
Esempio n. 13
0
	uintptr_t get_jass_thread()
	{
		uintptr_t ptr = get_war3_searcher().get_instance(5);
		return *(uintptr_t*)(*(uintptr_t*)(ptr + 0x0C) + 4 * *(uintptr_t*)(ptr + 0x14) - 4);
	}
Esempio n. 14
0
	hashtable::native_func_table* get_native_function_hashtable()
	{
		return (hashtable::native_func_table*)(get_war3_searcher().get_instance(5)+0x18);
	}
Esempio n. 15
0
	uintptr_t get_jass_virtual_machine()
	{
		war3_searcher& s = get_war3_searcher();
		return *(uintptr_t*)(*(uintptr_t*)(s.get_instance(5)+0x90)+0x04) - ((s.get_version() > version_120e) ? 0: 4);
	}
Esempio n. 16
0
uint32_t _cdecl FakeGetUnitState(uint32_t unit_handle, uint32_t state_type)
{
	switch (state_type)
	{
	case UNIT_STATE_DAMAGE_DICE:
	case UNIT_STATE_DAMAGE_SIDE:
	case UNIT_STATE_DAMAGE_BASE:
	case UNIT_STATE_DAMAGE_BONUS:
	case UNIT_STATE_DAMAGE_MIN:
	case UNIT_STATE_DAMAGE_MAX:
	case UNIT_STATE_DAMAGE_RANGE:
	case UNIT_STATE_ARMOR:
		break;
	default:
		return aero::c_call<uint32_t>(RealGetUnitState, unit_handle, state_type);
	}

	war3_searcher&s = get_war3_searcher();
	uintptr_t unit_object = s.unit_handle_to_object(unit_handle);
	if (!unit_object)
	{
		return 0;
	}

	if (state_type == UNIT_STATE_ARMOR)
	{
		return *(uint32_t*)(unit_object + 0xE0);
	}

	unit_property* ptr = (unit_property*)*(uintptr_t*)(unit_object + 0x1E4 + (s.get_version() > version_124c ? 4: 0));
	if (!ptr)
	{
		return 0;
	}

	int32_t retval = 0;
	switch (state_type)
	{
	case UNIT_STATE_DAMAGE_DICE:
		retval = ptr->damage_dice;
		break;
	case UNIT_STATE_DAMAGE_SIDE:
		retval = ptr->damage_side;
		break;
	case UNIT_STATE_DAMAGE_BASE:
		retval = ptr->damage_base;
		break;
	case UNIT_STATE_DAMAGE_BONUS:
		retval = ptr->damage_bonus;
		break;
	case UNIT_STATE_DAMAGE_MIN:
		retval = ptr->damage_base + ptr->damage_bonus + ptr->damage_dice;
		break;
	case UNIT_STATE_DAMAGE_MAX:
		retval = ptr->damage_base + ptr->damage_bonus + ptr->damage_dice * ptr->damage_side;
		break;
	case UNIT_STATE_DAMAGE_RANGE:
		return ptr->damage_ranage;
	default:
		retval = 0;
		break;
	}

	return jass::to_real((float)retval);
}
Esempio n. 17
0
uint32_t _cdecl EXGetUnitObject(uint32_t unit_handle)
{
	return get_war3_searcher().unit_handle_to_object(unit_handle);
}
Esempio n. 18
0
	bool is_gaming()
	{
		return get_war3_searcher().is_gaming();
	}