Ejemplo n.º 1
0
static int trylock(const std::multimap<std::wstring, unsigned long long int> &pids) {
	posptr = frontptr = topptr = NULL;

	if (! initialize(pids, L"Breach.exe", L"fmodex.dll"))
		return false;

	// Checking the version of Breach
	char version[12];
	if ((! peekProc(0x1118f98, &version, sizeof(version))) || (strncmp("breach 1.1.0", version, sizeof(version)) != 0)) {
		generic_unlock();
		return false;
	}

	// Setting the pointers for the avatar information
	procptr32_t ptr1 = peekProc<procptr32_t>(pModule + 0x177980);
	if (ptr1 == 0) {
		generic_unlock();
		return false;
	}
	posptr = ptr1 + 0x9200;
	frontptr = ptr1 + 0x9248;
	topptr = ptr1 + 0x9230;

	// Final check by calling fetch.
	float apos[3], afront[3], atop[3], cpos[3], cfront[3], ctop[3];
	std::string context;
	std::wstring identity;
	if (! fetch(apos, afront, atop, cpos, cfront, ctop, context, identity)) {
		generic_unlock();
		return false;
	}

	return true;
}
Ejemplo n.º 2
0
static int trylock(const std::multimap<std::wstring, unsigned long long int> &pids) {
	posptr = frontptr = topptr = contextptraddress = stateaddress = loginaddress = NULL;

	if (!initialize(pids, L"Borderlands.exe"))
		return false;

	// Trying to assess which version of Borderlands is running.
	char version[6];
	if (!peekProc((BYTE *) 0x01f16ce8, &version, sizeof(version))) {
		generic_unlock();
		return false;
	}

	BYTE *ptraddress;
	if (strncmp("the cl", version, sizeof(version)) == 0) { // retail version
		ptraddress = (BYTE *) 0x01f73744;
		stateaddress = (BYTE *) 0x01f9bb18;
		contextptraddress = (BYTE *) 0x01fd7398;
		loginaddress = (BYTE *) 0x01fd83a8;
	} else if (strncmp("Tir-ku", version, sizeof(version)) == 0) { // steam version
		ptraddress = (BYTE *) 0x01f705c4;
		stateaddress = (BYTE *) 0x01f98998;
		contextptraddress = (BYTE *) 0x01fd4218;
		loginaddress = (BYTE *) 0x01fd5220;
	} else if (strncmp("german", version, sizeof(version)) == 0) { // german version
		ptraddress = (BYTE *) 0x01f72744;
		stateaddress = (BYTE *) 0x01f9ab18;
		contextptraddress = (BYTE *) 0x01fd6398;
		loginaddress = (BYTE *) 0x01fd73a8;
	} else { // unknown version
		generic_unlock();
		return false;
	}

	BYTE *ptr1 = peekProc<BYTE *>(ptraddress);
	if (ptr1 == 0) {
		generic_unlock();
		return false;
	}

	posptr = ptr1 + 0x9200;
	frontptr = ptr1 + 0x9248;
	topptr = ptr1 + 0x9230;

	float apos[3], afront[3], atop[3], cpos[3], cfront[3], ctop[3];
	std::string context;
	std::wstring identity;

	if (fetch(apos, afront, atop, cpos, cfront, ctop, context, identity)) {
		return true;
	} else {
		generic_unlock();
		return false;
	}
}
Ejemplo n.º 3
0
static int trylock(const std::multimap<std::wstring, unsigned long long int> &pids) {
    posrotptr = NULL;

    if (! initialize(pids, L"hl2.exe", L"client.dll"))
        return false;

    BYTE *mod_engine=getModuleAddr(L"engine.dll");
    if (!mod_engine)
        return false;

    // Remember addresses for later
    posrotptr = pModule + 0x8D8694;
    stateptr = pModule + 0x849284;
    hostptr = mod_engine + 0x3EA20C;

    // Gamecheck
    char sMagic[13];
    if (!peekProc(mod_engine + 0x564C78, sMagic) || strncmp("DemomanTaunts", sMagic, sizeof(sMagic))!=0)
        return false;

    // Check if we can get meaningful data from it
    float apos[3], afront[3], atop[3];
    float cpos[3], cfront[3], ctop[3];
    std::wstring sidentity;
    std::string scontext;

    if (fetch(apos, afront, atop, cpos, cfront, ctop, scontext, sidentity)) {
        return true;
    } else {
        generic_unlock();
        return false;
    }
}
Ejemplo n.º 4
0
static int trylock(const std::multimap<std::wstring, unsigned long long int> &pids) {
	posptr = rotptr = stateptr = contextptr = NULL;

	if (! initialize(pids, L"left4dead2.exe", L"client.dll"))
		return false;

	posptr = pModule + 0x641A4C;
	rotptr = pModule + 0x641A08;
	stateptr = pModule + 0x6A1AF4;
	contextptr = pModule + 0x6f487c;
	
	float pos[3];
	float rot[3];
	float opos[3], top[3], front[3];
	char state, _context[21];
	bool ok = peekProc(posptr, pos, 12) &&
	          peekProc(rotptr, rot, 12) &&
			  peekProc(stateptr, &state, 1) &&
			  peekProc(contextptr, _context);

	if (ok)
		return calcout(pos, rot, opos, top, front);

	generic_unlock();

	return false;
}
Ejemplo n.º 5
0
static int trylock(const std::multimap<std::wstring, unsigned long long int> &pids) {
	posptr = faceptr = topptr = 0;

	if (! initialize(pids, L"BFHeroes.exe", L"BFAudio.dll"))
		return false;

	procptr_t cacheaddr = pModule + 0x4745c;
	procptr_t cache = peekProcPtr(cacheaddr);

	posptr = peekProcPtr(cache + 0xc0);
	faceptr = peekProcPtr(cache + 0xc4);
	topptr = peekProcPtr(cache + 0xc8);
	stateptr = peekProcPtr(cache + 0xc0);

	float apos[3], afront[3], atop[3], cpos[3], cfront[3], ctop[3];
	std::string context;
	std::wstring identity;

	if (fetch(apos, afront, atop, cpos, cfront, ctop, context, identity)) {
		return true;
	} else {
		generic_unlock();
		return false;
	}
}
Ejemplo n.º 6
0
static int trylock(const std::multimap<std::wstring, unsigned long long int> &pids) {
	posrotptr = stateptr = hostptr = NULL;

	if (! initialize(pids, L"hl2.exe", L"client.dll"))
		return false;

	// Remember addresses for later
	posrotptr = pModule + 0x8F9334;
	stateptr = pModule + 0x869034;
	hostptr = pModule + 0x918044;

	// Gamecheck - check if we're looking at the right game
	char sMagic[7];
	if (!peekProc(pModule + 0x882CE2, sMagic) || strncmp("Demoman", sMagic, sizeof(sMagic))!=0)
		return false;

	// Check if we can get meaningful data from it
	float apos[3], afront[3], atop[3];
	float cpos[3], cfront[3], ctop[3];
	std::wstring sidentity;
	std::string scontext;

	if (fetch(apos, afront, atop, cpos, cfront, ctop, scontext, sidentity)) {
		return true;
	} else {
		generic_unlock();
		return false;
	}
}
Ejemplo n.º 7
0
static int trylock(const std::multimap<std::wstring, unsigned long long int> &pids) {

	if (! initialize(pids, L"left4dead.exe", L"client.dll")) { // Retrieve "client.dll" module's memory address
		return false;
	}

	// Server ID
	steamclient = getModuleAddr(L"steamclient.dll"); // Retrieve "steamclient.dll" module's memory address
	// This prevents the plugin from linking to the game in case something goes wrong during module's memory address retrieval.
	if (steamclient == 0)
		return false;

	// Host & Player ID
	engine = getModuleAddr(L"engine.dll"); // Retrieve "engine.dll" module's memory address
	// This prevents the plugin from linking to the game in case something goes wrong during module's memory address retrieval.
	if (engine == 0)
		return false;

	// Check if we can get meaningful data from it
	float apos[3], afront[3], atop[3], cpos[3], cfront[3], ctop[3];
	std::wstring sidentity;
	std::string scontext;

	if (fetch(apos, afront, atop, cpos, cfront, ctop, scontext, sidentity)) {
		return true;
	} else {
		generic_unlock();
		return false;
	}
}
Ejemplo n.º 8
0
static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, float *camera_pos, float *camera_front, float *camera_top, std::string &, std::wstring &) {
	for (int i=0;i<3;i++)
		avatar_pos[i] = avatar_front[i] = avatar_top[i] = camera_pos[i] = camera_front[i] = camera_top[i] = 0.0f;

	//char ccontext[128];
	//char state;
	bool ok;

	/*
	ok = peekProc((BYTE *) 0x0, &state, 1); // Magical state value
	if (! ok)
		return false;
	*/

	// Find out whether this is the steam version
	char sMagic[6];
	if (!peekProc((BYTE *) 0x015715b4, sMagic, 6)) {
		generic_unlock();
		return false;
	}

	is_steam = (strncmp("Score:", sMagic, 6) == 0);

	if (is_steam) {
		ok = peekProc((BYTE *) 0x01571E90, avatar_pos, 12) &&
		     peekProc((BYTE *) 0x01571E80, avatar_front, 12) &&
		     peekProc((BYTE *) 0x01571E70, avatar_top, 12);
	} else {
		ok = peekProc((BYTE *) 0x01579600, avatar_pos, 12) &&
		     peekProc((BYTE *) 0x015795F0, avatar_front, 12) &&
		     peekProc((BYTE *) 0x015795E0, avatar_top, 12);
	}

	if (! ok)
		return false;

	// Disable when not in game
	if (avatar_pos[1] == 9999)
		return true;

	/*
	    Get context string; in this plugin this will be an
	    ip:port (char 256 bytes) string

	ccontext[127] = 0;
	context = std::string(ccontext);
	*/
	/*
	if (state == 0)
		return true; // This results in all vectors beeing zero which tells Mumble to ignore them.
	*/

	for (int i=0;i<3;i++) {
		camera_pos[i] = avatar_pos[i];
		camera_front[i] = avatar_front[i];
		camera_top[i] = avatar_top[i];
	}

	return ok;
}
Ejemplo n.º 9
0
/**
 * 装载TTA音乐文件 
 *
 * @param spath 短路径名
 * @param lpath 长路径名
 *
 * @return 成功时返回0
 */
static int tta_load(const char *spath, const char *lpath)
{
	__init();

	if (tta_read_tag(spath) != 0) {
		__end();
		return -1;
	}

	if (g_buff != NULL) {
		free(g_buff);
		g_buff = NULL;
	}
	g_buff = calloc(TTA_BUFFER_SIZE, sizeof(*g_buff));
	if (g_buff == NULL) {
		__end();
		return -1;
	}

	if (open_tta_file(spath, &ttainfo, 0, g_io_buffer_size) < 0) {
		dbg_printf(d, "TTA Decoder Error - %s", get_error_str(ttainfo.STATE));
		close_tta_file(&ttainfo);
		return -1;
	}

	if (player_init(&ttainfo) != 0) {
		__end();
		return -1;
	}

	if (ttainfo.BPS == 0) {
		__end();
		return -1;
	}

	g_info.samples = ttainfo.DATALENGTH;
	g_info.duration = (double) ttainfo.LENGTH;
	g_info.sample_freq = ttainfo.SAMPLERATE;
	g_info.channels = ttainfo.NCH;
	g_info.filesize = ttainfo.FILESIZE;

	if (xAudioInit() < 0) {
		__end();
		return -1;
	}

	if (xAudioSetFrequency(ttainfo.SAMPLERATE) < 0) {
		__end();
		return -1;
	}

	xAudioSetChannelCallback(0, tta_audiocallback, NULL);

	generic_lock();
	g_status = ST_LOADED;
	generic_unlock();

	return 0;
}
Ejemplo n.º 10
0
int generic_play(void)
{
	generic_lock();
	generic_set_playback(true);
	g_status = ST_PLAYING;
	generic_unlock();

	return 0;
}
Ejemplo n.º 11
0
/**
 * 处理快进快退
 *
 * @return
 * - -1 should exit
 * - 0 OK
 */
static int handle_seek(void)
{
	if (g_status == ST_FFORWARD) {
		generic_lock();
		g_status = ST_PLAYING;
		generic_unlock();
		generic_set_playback(true);
		mp3_seek_seconds(g_play_time + g_seek_seconds);
	} else if (g_status == ST_FBACKWARD) {
		generic_lock();
		g_status = ST_PLAYING;
		generic_unlock();
		generic_set_playback(true);
		mp3_seek_seconds(g_play_time - g_seek_seconds);
	}

	return 0;
}
Ejemplo n.º 12
0
int generic_pause(void)
{
	generic_lock();
	generic_set_playback(false);
	g_status = ST_PAUSED;
	generic_unlock();

	return 0;
}
Ejemplo n.º 13
0
/**
 * 停止MP3音乐文件的播放,销毁资源等
 *
 * @note 可以在播放线程中调用
 *
 * @return 成功时返回0
 */
static int __end(void)
{
	xAudioEndPre();

	g_play_time = 0.;
	generic_lock();
	g_status = ST_STOPPED;
	generic_unlock();

	return 0;
}
Ejemplo n.º 14
0
int generic_resume(const char *spath, const char *lpath)
{
	generic_lock();
	g_status = g_suspend_status;

	if (g_status == ST_PLAYING)
		generic_set_playback(true);

	generic_unlock();
	g_suspend_status = ST_LOADED;

	return 0;
}
Ejemplo n.º 15
0
static int trylock(const std::multimap<std::wstring, unsigned long long int> &pids) {
	if (! initialize(pids, L"CoDWaWmp.exe"))
		return false;

	float apos[3], afront[3], atop[3], cpos[3], cfront[3], ctop[3];
	std::string context;
	std::wstring identity;

	if (fetch(apos, afront, atop, cpos, cfront, ctop, context, identity)) {
		return true;
	} else {
		generic_unlock();
		return false;
	}
}
Ejemplo n.º 16
0
/**
 * 快退音乐文件
 *
 * @param sec 秒数
 *
 * @return 成功时返回0
 */
int generic_fbackward(int sec)
{
	generic_lock();
	if (g_status == ST_PLAYING || g_status == ST_PAUSED
		|| g_status == ST_FFORWARD)
		g_status = ST_FBACKWARD;

	g_seek_seconds = sec;

	xrRtcGetCurrentTick((u64 *) & g_last_seek_tick);
	g_last_seek_is_forward = false;
	g_seek_count++;
	generic_unlock();

	return 0;
}
Ejemplo n.º 17
0
static int trylock(const std::multimap<std::wstring, unsigned long long int> &pids) {
	if (!initialize(pids, L"JustCause2.exe"))
		return false;

	float apos[3], afront[3], atop[3];
	float cpos[3], cfront[3], ctop[3];
	std::wstring sidentity;
	std::string scontext;

	if (setuppointers() && fetch(apos, afront, atop, cpos, cfront, ctop, scontext, sidentity)) {
		return true;
	} else {
		generic_unlock();
		return false;
	}
}
Ejemplo n.º 18
0
static int trylock(const std::multimap<std::wstring, unsigned long long int> &pids) {
	if (! initialize(pids, L"Wow.exe", L"WoW.exe"))
		return false;

	p_playerBase=getPlayerBase();
	if (p_playerBase != 0) {
		float apos[3], afront[3], atop[3], cpos[3], cfront[3], ctop[3];
		std::string context;
		std::wstring identity;

		if (fetch(apos, afront, atop, cpos, cfront, ctop, context, identity))
			return true;
	}

	generic_unlock();
	return false;
}
Ejemplo n.º 19
0
static int trylock(const std::multimap<std::wstring, unsigned long long int> &pids) {

	if (! initialize(pids, L"RocketLeague")) // Link the game executable
		return false;

	// Check if we can get meaningful data from it
	float apos[3], afront[3], atop[3], cpos[3], cfront[3], ctop[3];
	std::wstring sidentity;
	std::string scontext;

	if (fetch(apos, afront, atop, cpos, cfront, ctop, scontext, sidentity)) {
		return true;
	} else {
		generic_unlock();
		return false;
	}
}
Ejemplo n.º 20
0
/**
 * 初始化驱动变量资源等
 *
 * @return 成功时返回0
 */
static int __init(void)
{
	generic_init();

	generic_lock();
	g_status = ST_UNKNOWN;
	generic_unlock();

	g_buff_frame_size = g_buff_frame_start = 0;
	g_seek_seconds = 0;

	g_play_time = 0.;

	g_samples_decoded = g_tta_data_offset = 0;
	memset(&g_info, 0, sizeof(g_info));

	return 0;
}
Ejemplo n.º 21
0
static int trylock(const std::multimap<std::wstring, unsigned long long int> &pids) {

	if (! initialize(pids, exe_name)) { // Retrieve "exe_name" module's memory address
		return false;
	}

	// Check if we can get meaningful data from it
	float apos[3], afront[3], atop[3], cpos[3], cfront[3], ctop[3];
	std::wstring sidentity;
	std::string scontext;

	if (fetch(apos, afront, atop, cpos, cfront, ctop, scontext, sidentity)) {
		return true;
	} else {
		generic_unlock();
		return false;
	}
}
Ejemplo n.º 22
0
/**
 * 初始化驱动变量资源等
 *
 * @return 成功时返回0
 */
static int __init(void)
{
	generic_init();

	generic_lock();
	g_status = ST_UNKNOWN;
	generic_unlock();

	memset(&g_inst_br, 0, sizeof(g_inst_br));
	memset(g_input_buff, 0, sizeof(g_input_buff));
	g_buff_frame_size = g_buff_frame_start = 0;
	g_seek_seconds = 0;

	g_play_time = 0.;
	memset(&mp3info, 0, sizeof(mp3info));
	memset(&g_info, 0, sizeof(g_info));

	return 0;
}
Ejemplo n.º 23
0
static int trylock(const std::multimap<std::wstring, unsigned long long int> &pids) {
	posptr = rotptr = stateptr = contextptr = NULL;

	if (! initialize(pids, L"left4dead2.exe", L"client.dll"))
		return false;
	/*
	Some hints to make things easier next time valve updates this game:
	use Cheat Engine (non-network single player or non VAC-secured servers to be safe)
	type is Float
	use unknown initial value
	use value unchanged/ value changed
	speed things up by limiting the scan range to 40000000 to 90000000 (hex number)
	you need addresses relative to client.dll. You can get address by double clicking on the address.
	
	pos: float likely in a range of 0 to 10000 (changes if you move. constant if you view around)
	rot: float in range of -180 to 180. If you look up the value is -89.0 . If you look down it is 89.0 (changes if you viewaround. constant if you only move)
	state: single player: search for loopback. Go back to menu. There is likely only one instance which has the string when having a game running and empty when not running a game.
	context: same as state appearantly

	*/
	posptr = pModule + 0x818950;
	rotptr = pModule + 0x7D0D18;
	stateptr = pModule + 0x8169BC;
	contextptr = pModule + 0x8169BC;
	
	float pos[3];
	float rot[3];
	char state, _context[21];
	bool ok = peekProc(posptr, pos, 12) &&
	          peekProc(rotptr, rot, 12) &&
			  peekProc(stateptr, &state, 1) &&
			  peekProc(contextptr, _context);

	if (ok) {
		float opos[3], top[3], front[3];
		return calcout(pos, rot, opos, top, front);
	}

	generic_unlock();

	return false;
}
Ejemplo n.º 24
0
static int trylock(const std::multimap<std::wstring, unsigned long long int> &pids) {

    if (! initialize(pids, L"bf3.exe"))
        return false;

    pmodule_bf3 = getModuleAddr(L"bf3.exe");
    if (!pmodule_bf3)
        return false;

    float apos[3], afront[3], atop[3], cpos[3], cfront[3], ctop[3];
    std::string context;
    std::wstring identity;

    if (!fetch(apos, afront, atop, cpos, cfront, ctop, context, identity)) {
        generic_unlock();
        return false;
    }

    return true;
}
Ejemplo n.º 25
0
static int trylock(const std::multimap<std::wstring, unsigned long long int> &pids) {

	if (! initialize(pids, L"Gw.exe"))
		return false;

	float cam[3], pos[3], front[3],camfront[3], top[3], camtop[3];
	std::string context;
	std::wstring identity;

	prev_areaid = 0;
	prev_location = 0;

	if (fetch(pos, front, top, cam, camfront, camtop, context, identity)) {
		prev_areaid = 0;
		prev_location = 0; // we need to do this again since fetch() above overwrites this (which results in empty context until next change)
		return true;
	} else {
		generic_unlock();
		return false;
	}
}
Ejemplo n.º 26
0
static int trylock(const std::multimap<std::wstring, unsigned long long int> &pids) {
	if (! initialize(pids, L"BLR.exe", L"pbcl.dll"))
		return false;

	if (refreshPointers()) { // unlink plugin if this fails

		*prev_hostipport = '\0';
		float avatar_pos[3], avatar_front[3], avatar_top[3];
		float camera_pos[3], camera_front[3], camera_top[3];
		std::string context;
		std::wstring identity;

		if (fetch(avatar_pos, avatar_front, avatar_top, camera_pos, camera_front, camera_top, context, identity)) {
			*prev_hostipport = '\0'; // we need to do this again since fetch() above overwrites this (which results in empty context until next change)
			return true;
		}
	}

	generic_unlock();
	return false;
}
Ejemplo n.º 27
0
static int trylock(const std::multimap<std::wstring, unsigned long long int> &pids) {
	posptr = NULL;

	if (! initialize(pids, L"arma2.exe"))
		return false;

	/*
	BYTE bState;
	peekProc((BYTE *) 0x00BF64D0, &bState, 1);
	if (bState == 0)
		return false;
	*/

	/*
	   Comment out code we don't need
	   BYTE *pModule=getModuleAddr(L"<module name, if you need it>.dll");
	   if (!pModule)
	*/

	BYTE *ptr1 = peekProc<BYTE *>((BYTE *) 0x00C500FC);

	BYTE *ptr2 = peekProc<BYTE *>(ptr1 + 0x88);

	BYTE *base = ptr2 + 0x10;

	posptr = base + 0x18;
	frontptr = base;
	topptr = base + 0xC;

	float apos[3], afront[3], atop[3], cpos[3], cfront[3], ctop[3];
	std::string context;
	std::wstring identity;

	if (fetch(apos, afront, atop, cpos, cfront, ctop, context, identity)) {
		return true;
	} else {
		generic_unlock();
		return false;
	}
}
Ejemplo n.º 28
0
static int trylock(const std::multimap<std::wstring, unsigned long long int> &pids) {

	if (!initialize(pids, L"BF2142.exe")) // Retrieve game executable's memory address
		return false;

	RendDX9 = getModuleAddr(L"RendDX9.dll"); // Retrieve "RendDX9.dll" module's memory address
	// This prevents the plugin from linking to the game in case something goes wrong during module's memory address retrieval.
	if (!RendDX9)
		return false;

	// Check if we can get meaningful data from it
	float apos[3], afront[3], atop[3], cpos[3], cfront[3], ctop[3];
	std::wstring sidentity;
	std::string scontext;

	if (fetch(apos, afront, atop, cpos, cfront, ctop, scontext, sidentity)) {
		return true;
	} else {
		generic_unlock();
		return false;
	}
}
Ejemplo n.º 29
0
static int trylock(const std::multimap<std::wstring, unsigned long long int> &pids) {

	if (! initialize(pids, L"UnrealTournament.exe", L"Engine.dll"))
		return false;

	BYTE* base = pModule + 0x290584;
	posptr = base;
	frtptr = base + 0x0C;
	topptr = base + 0x18;

	// Check if we can get meaningful data from it
	float apos[3], afront[3], atop[3];
	float cpos[3], cfront[3], ctop[3];
	std::wstring sidentity;
	std::string scontext;

	if (fetch(apos, afront, atop, cpos, cfront, ctop, scontext, sidentity)) {
		return true;
	} else {
		generic_unlock();
		return false;
	}
}
Ejemplo n.º 30
0
static int trylock(const std::multimap<std::wstring, unsigned long long int> &pids) {
	faceptr = topptr = 0;

	if (! initialize(pids, L"BF1942.exe"))
		return false;

	procptr_t ptr1 = peekProcPtr(0x009A9468);
	procptr_t ptr2 = peekProcPtr(ptr1 + 0x98);

	faceptr = ptr2 + 0x5C;
	topptr = ptr2 + 0x4C;

	float apos[3], afront[3], atop[3], cpos[3], cfront[3], ctop[3];
	std::string context;
	std::wstring identity;

	if (fetch(apos, afront, atop, cpos, cfront, ctop, context, identity)) {
		return true;
	} else {
		generic_unlock();
		return false;
	}
}