Raised This Month: $51 Target: $400
 12% 

CSGO vaudio_celt


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
elpax
Junior Member
Join Date: Feb 2017
Old 06-04-2017 , 08:19   CSGO vaudio_celt
Reply With Quote #1

I found this extension GitHub and now trying to rewrite it to Linux from Windows.

Extension have this snippet for Windows:
Code:
	char path[PLATFORM_MAX_PATH];
	g_pSM->BuildPath(Path_Game, path, sizeof(path), "../bin/vaudio_celt.dll");
	lib = LoadLibrary(path);
	if (!lib) {
		snprintf(error, maxlength, "LoadLibrary failed.");
		return false;
	}
	CreateInterfaceFn createCodecFn;
	createCodecFn = (CreateInterfaceFn)GetProcAddress(lib, "CreateInterface");
	if (!createCodecFn) {
		snprintf(error, maxlength, "GetProcAddress failed.");
		return false;
	}
	voiceCodec = (IVoiceCodec*)createCodecFn("vaudio_celt", NULL);
	if (!voiceCodec) {
		snprintf(error, maxlength, "Create Voice VoiceCodec error");
		return false;
	}
	if (!voiceCodec->Init(QUALITY)) {
		snprintf(error, maxlength, "Voice VoiceCodec Init error");
		return false;
	}

	sharesys->AddInterface(myself, this);
I changed it too: (P.S. #include <dlfcn.h> needed)
Code:
	char path[PLATFORM_MAX_PATH];
	g_pSM->BuildPath(Path_Game, path, sizeof(path), "../bin/vaudio_celt_client.so");
	g_pModule = dlopen( path, RTLD_NOW );
	CreateInterfaceFn createCodecFn;
	createCodecFn = (CreateInterfaceFn) dlsym( g_pModule, "CreateInterface" );
	if (!createCodecFn) {
		snprintf(error, maxlength, "GetProcAddress failed.");
		return false;
	}
	voiceCodec = (IVoiceCodec*)createCodecFn("vaudio_celt", NULL);
	if (!voiceCodec) {
		snprintf(error, maxlength, "Create Voice VoiceCodec error");
		return false;
	}
	if (!voiceCodec->Init(QUALITY)) {
		snprintf(error, maxlength, "Voice VoiceCodec Init error");
		return false;
	}

	sharesys->AddInterface(myself, this);
It compiles normally and loads into csgo "normally" too. It prints Create Voice VoiceCodec error. So error somewhere in this line:
Code:
voiceCodec = (IVoiceCodec*)createCodecFn("vaudio_celt", NULL);
And I don't know what is wrong. Need help.
elpax is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 06-04-2017 , 08:42   Re: CSGO vaudio_celt
Reply With Quote #2

dlopen is probably failing, and you do not have any checks for that, so dlsym will be being called with nullptr which is equivalent to RTLD_DEFAULT, so you'll be getting the CreateInterface from some random library, so it knows nothing about vaudio_celt.
__________________
asherkin is offline
elpax
Junior Member
Join Date: Feb 2017
Old 06-04-2017 , 08:56   Re: CSGO vaudio_celt
Reply With Quote #3

Thanks. I'm forget to add check. Now I see that it can't dlopen the library. But why ?

EDIT:
Fixed the error. I found out that error was: libuuid.so.1: cannot open shared object file: No such file or directory.
I did this:
apt-get install libuuid1:i386

Last edited by elpax; 06-04-2017 at 09:19.
elpax is offline
Oylsister
Senior Member
Join Date: Aug 2019
Location: KhonKaen, Thailand
Old 11-17-2021 , 20:00   Re: CSGO vaudio_celt
Reply With Quote #4

Quote:
Originally Posted by elpax View Post
Thanks. I'm forget to add check. Now I see that it can't dlopen the library. But why ?

EDIT:
Fixed the error. I found out that error was: libuuid.so.1: cannot open shared object file: No such file or directory.
I did this:
apt-get install libuuid1:i386
__________________
Oylsister is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:36.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode