About Monkey 2 › Forums › Monkey 2 Development › MumbleLink (Memory Shared File)
This topic contains 1 reply, has 1 voice, and was last updated by 
 Hezkore
 2 years, 1 month ago.
- 
		AuthorPosts
 - 
		
			
				
February 9, 2017 at 7:09 am #7048
I’m trying to get some information from the game Guild Wars 2, things such as player position.
Apparently the game supports something called Mumble, which is a VOIP application with positional sound.
And for Mumble to work, Guild Wars 2 creates something called a MumbleLink, which is a shared memory file.
Now… I’ve found this: https://wiki.guildwars2.com/wiki/API:MumbleLink
It tells us exactly how the MumbleLink file is structured.
And here’s some actual code from the Mumble Wiki: http://wiki.mumble.info/wiki/LinkI’m not very familiar with C++ so this doesn’t really help me a whole lot heh.
But I do know that Monkey 2 can import external code like that.
Can I somehow use that code to access the Guild Wars 2 data I need?February 24, 2017 at 2:34 pm #7277I’ve managed to get Mumble working, and this should work with any Mumble supported game.
You’ll need this mumble.h file:C++123456789101112131415161718192021222324252627282930313233#include <windows.h>struct LinkedMem {UINT32 uiVersion;DWORD uiTick;float fAvatarPosition[3];float fAvatarFront[3];float fAvatarTop[3];wchar_t name[256];float fCameraPosition[3];float fCameraFront[3];float fCameraTop[3];wchar_t identity[256];UINT32 context_len;unsigned char context[256];wchar_t description[2048];};static LinkedMem *lm = NULL;static void initMumble() {// HANDLE hMapObject = OpenFileMappingW(FILE_MAP_ALL_ACCESS, FALSE, L"MumbleLink");HANDLE hMapObject = CreateFileMappingW(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, sizeof(LinkedMem), L"MumbleLink");if (hMapObject == NULL)return;lm = (LinkedMem *) MapViewOfFile(hMapObject, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(LinkedMem));if (lm == NULL) {CloseHandle(hMapObject);hMapObject = NULL;return;}}And here’s the Monkey 2 wrapper for it:
Monkey123456789101112131415161718192021222324252627282930313233343536373839404142Namespace mumble#Import "mumble.h"ExternStruct LinkedMemField uiVersion:UIntField fAvatarPosition:Float[]Field fAvatarFront:Float[]Field fAvatarTop:Float[]Field fCameraPosition:Float[]Field fCameraFront:Float[]Field fCameraTop:Float[]Field name:StringField identity:StringField context_len:IntField context:UByte[]Field description:StringEndFunction initMumble_C:Void()="initMumble"Function updateMumble_C:Void()="updateMumble"Global lm:LinkedMem PtrPublicGlobal link:LinkedMemFunction InitMumble:Int()initMumble_C()If lm Thenlink=lm[0]Return 1ElseReturn 0EndifEndFunction UpdateMumble()If lm Then link=lm[0]EndYou use it by first calling InitMumble()
Then call UpdateMumble() as you want new information. (every frame)
You then use the Global link variable to check your avatars/cameras position, rotation, name etc. - 
		AuthorPosts
 
You must be logged in to reply to this topic.