PDA

View Full Version : function request makefunctionpointer(path, function)



kung foo man
17th March 2014, 19:07
Hey, just so some collection info doesn't get lost in Xfire history:



[19:56] IzNoGoD: easy libcod request i think
[19:57] IzNoGoD: function = makefunctionpointer(path, function);
[19:58] kung foo man: not that easy
[19:58] IzNoGoD: dang
[19:58] IzNoGoD: talking to php about it now xD
[19:58] kung foo man: ive tried that once but it always crashed and didnt care enough
[19:58] IzNoGoD: damn
[19:58] kung foo man: on init() in codscript its possible ofc
[19:58] IzNoGoD: i only need it on init()
[19:58] kung foo man: php might know though, he has lot of info from cod1
[19:58] IzNoGoD: not during the game
[19:59] IzNoGoD:
19:58] php: tried
[19:58] php: didnt work
[19:58] php: cod 1 did
[19:59] kung foo man: well init() in C, not codscript ^^
[19:59] kung foo man: ah
[19:59] IzNoGoD: https://github.com/riicchhaarrd/CoDExtended/blob/master/xtnded/Patch%201.5%20Only/windows/script.cpp
[19:59] IzNoGoD: (c) php
[20:00] IzNoGoD:


[19:59] php: void callScript() {
if(Cmd_Argc() < 2) {
Com_Printf("Usage: callscript <handle>\n");
return;
}

int handle = atoi(Cmd_Argv(0));
int result = Scr_ExecThread(handle, 0);
Scr_FreeThread(result);
}
[20:00] php: void GScr_parsefunc(int a1) {
int handle = Scr_GetFunc(0);
Com_Printf("parsefunc: %d\n", handle);
int result = Scr_ExecThread(handle, 0);
Scr_FreeThread(result);
}


[20:00] kung foo man: you can ask in forum, maybe somebody knows/cares enough ^^
[20:01] IzNoGoD:


int Scr_LoadFunction(const char* file, const char* functionname) {
if(!call<int, const char*>(0x472DC0, file))
Com_Printf("Could not find script '%s'\n", file);

int v4 = call<int, const char*, const char*>(0x472AB0, file, functionname);
if(!v4)
Com_Printf("Could not find label '%s' in script '%s'\n", functionname, file);
printf("callback[%s] = %x\n", functionname, v4);
return v4;
}


[20:01] kung foo man: can i copy this in forum for later reference?
[20:02] IzNoGoD: its on his github
[20:02] IzNoGoD: so i would say yes


I would like to have that function also, so if anybody cares enough, go for it. :D