Raised This Month: $7 Target: $400
 1% 

[L4D2] Changing finale stage crashes the server


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xerox8521
Senior Member
Join Date: Sep 2011
Old 06-29-2017 , 07:42   [L4D2] Changing finale stage crashes the server
Reply With Quote #1

Hey,

in l4d2 the survival finale has different stages. now the thing is so far everytime i tried to change the stage to something different the server instantly crashes and im not sure why exactly. Even tried the function provided by l4downtown2 but it doesn't work either same result. Other director functions calls work fine.

These are the functions i tried to call:

Code:
"CDirectorScriptedEventManager::ChangeFinaleStage"
{
        "library"	"server"
	"linux"         "@_ZN29CDirectorScriptedEventManager17ChangeFinaleStageENS_18ScriptedEventStageEPKc"
}
"CDirectorScriptedEventManager::ChangeScriptedStage"
{
	"library"	"server"
	"linux"		"@_ZN29CDirectorScriptedEventManager24ChangeScriptedEventStageEiPKc"
}
Code is based on l4downtown 2:

PHP Code:
cell_t Native_ChangeFinaleStageEx(IPluginContext *pContext, const cell_t *params)
{
    static 
ICallWrapper *pWrapper NULL;
    if(!
pWrapper)
    {
        
REGISTER_NATIVE_ADDR("CDirectorScriptedEventManager::ChangeScriptedStage",
            
PassInfo pass[2];\
            
            
pass[0].flags PASSFLAG_BYVAL;\
            
pass[0].size sizeof(int);\
            
pass[0].type PassType_Basic;\
            
            
pass[1].flags PASSFLAG_BYVAL;\
            
pass[1].size sizeof(char *);\
            
pass[1].type PassType_Basic;\
            
            
pWrapper g_pBinTools->CreateCall(addr,CallConv_ThisCallNULLpass2));
    }
    
    
bCanChangeFinaleStage true;
    
    if(!
g_pDirector)
    {
        return 
pContext->ThrowNativeError("g_pDirector is null");
    }
    
    
CDirector *director = *g_pDirector;
    
    if(!
director)
    {
        return 
pContext->ThrowNativeError("CDirector is not available");
    }
    
    
CDirectorScriptedEventManager *semdirector director->ScriptedEventManagerPtr;
    if(!
semdirector)
    {
        return 
pContext->ThrowNativeError("CDirectorScriptedEventManager is not available");
    }
    
    
char *arg NULL;
    
pContext->LocalToString(params[2], &arg);
    
    
unsigned char vstk[sizeof(void *) + sizeof(int) + sizeof(char *)];
    
unsigned char *vptr vstk;
    
    *(
void **)vptr semdirector;
    
vptr += sizeof(void *);
    
    *(
int *)vptr params[1];
    
vptr += sizeof(int);
    
    *(
char **)vptr arg;
    
    
pWrapper->Execute(vstkNULL);
    return 
1;
}

cell_t Native_ChangeFinaleStage(IPluginContext *pContext, const cell_t *params)
{
    static 
ICallWrapper *pWrapper NULL;
    if(!
pWrapper)
    {
        
REGISTER_NATIVE_ADDR("CDirectorScriptedEventManager::ChangeFinaleStage",
            
PassInfo pass[2];\
            
            
pass[0].flags PASSFLAG_BYVAL;\
            
pass[0].size sizeof(int);\
            
pass[0].type PassType_Basic;\
            
            
pass[1].flags PASSFLAG_BYVAL;\
            
pass[1].size sizeof(char *);\
            
pass[1].type PassType_Basic;\
            
            
pWrapper g_pBinTools->CreateCall(addr,CallConv_ThisCallNULLpass2));
    }
    
    
bCanChangeFinaleStage true;
    
    if(!
g_pDirector)
    {
        return 
pContext->ThrowNativeError("g_pDirector is null");
    }
    
    
CDirector *director = *g_pDirector;
    
    if(!
director)
    {
        return 
pContext->ThrowNativeError("CDirector is not available");
    }
    
    
CDirectorScriptedEventManager *semdirector director->ScriptedEventManagerPtr;
    if(!
semdirector)
    {
        return 
pContext->ThrowNativeError("CDirectorScriptedEventManager is not available");
    }
    
    
char *arg NULL;
    
pContext->LocalToString(params[2], &arg);
    
    
unsigned char vstk[sizeof(void *) + sizeof(int) + sizeof(char *)];
    
unsigned char *vptr vstk;
    
    *(
void **)vptr semdirector;
    
vptr += sizeof(CDirectorScriptedEventManager *);
    
    *(
int *)vptr params[1];
    
vptr += sizeof(int);
    
    *(
char **)vptr arg;
    
    
pWrapper->Execute(vstkNULL);
    return 
1;

OS: Centos 7

Last edited by xerox8521; 06-29-2017 at 07:45.
xerox8521 is offline
Reply


Thread Tools
Display Modes

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 03:45.


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