crashdome 3 Posted May 11, 2005 Quote[/b] ]... AND it isn't triggered by OFP's file access, as I already said, that OFP doesn't update the Last Access time stamp... Bah.. I missed that somewhere Quote[/b] ]And that .NET-class doesn't anything you could not do with the WinAPI.Kegetys injection hook is by far superior. My DLL can log/write text into files and it can create and overwrite files. It can, like Kegetys has done it, convert strings into arrays of strings, and I am looking into it being expandable through DLLs. I am well aware of what .NET is. I just jumped at the idea that .NET already had a managed class which would require no additional DLLs for me to include in my software. I could just as easily create my own similar DLL in .NET using Win32Api hooks that mimicked Kegs, but again, I was just jumping at the possibility there was ease of use in using FileSystemWatcher (before I understood the above) to monitor a single OFP file (not perform any writes) and I'm certainly not trying to piss on anyones work. Â Â EDIT: I did just test the object.sav file located in a users Tmp folder. It does modify Last Access and I could use FileSystemWatcher class to monitor that exact file. This DOES NOT intercept script calls as does your DLL, but this could be useful in obtaining MP data from a "saveStatus" command in OFP... which is what SOW uses... I guess this is a different approach and idea, but I think it has some merit. Share this post Link to post Share on other sites
kegetys 2 Posted May 12, 2005 Hooking test under LinuxOk, I've found how API-hooking is done under Linux. But as I don't manage to get an OFP Linux server running on my box, I ask, if someone could try it for me... The OFP server binary has glibc statically linked so the method you described propably does not work... Share this post Link to post Share on other sites
vektorboson 8 Posted May 12, 2005 Hooking test under LinuxOk, I've found how API-hooking is done under Linux. But as I don't manage to get an OFP Linux server running on my box, I ask, if someone could try it for me... The OFP server binary has glibc statically linked so the method you described propably does not work... Already thought something like that... Â And I'm not going to implement that kernel hook; it involves writing a kernel module that changes the syscall-table (at least in a document I found, which was for Kernel 2.0.x). Look at http://packetstormsecurity.nl/docs/hack/LKM_HACKING.html Probably you have to change something for Kernel 2.4.x or 2.6.x Share this post Link to post Share on other sites
zyklone 1 Posted May 12, 2005 It's unfortunate that BIS linked the linux binary statically. One approach to execute a generated .sqs file still remains on linux, a FIFO pipe. I don't think it'd be possible to give the pipe any function arguments etc though. And it's possible that approach would run into other problems. Share this post Link to post Share on other sites
zyklone 1 Posted May 12, 2005 It's unfortunate that BIS linked the linux binary statically.One approach to execute a generated .sqs file still remains on linux, a FIFO pipe. I don't think it'd be possible to give the pipe any function arguments etc though. And it's possible that approach would run into other problems. Actually, I changed my mind. The best approach under linux is to use a virutal filesystem like http://fuse.sourceforge.net/ It'll allow the same kind of argument passing as in Kegetys' example, but perhaps not with the same pretty :<script> interface. Share this post Link to post Share on other sites
stegman 3 Posted May 12, 2005 Heres one to cook your heads. Is it possible to use the windows clock for ingame play? If you can call images or change files durring play shurly you can access windows, get the time, then change OFP mission time with some kind of script in the init file....? Share this post Link to post Share on other sites
vektorboson 8 Posted May 12, 2005 Heres one to cook your heads.Is it possible to use the windows clock for ingame play? Â If you can call images or change files durring play shurly you can access windows, get the time, then change OFP mission time with some kind of script in the init file....? Short answer: Yes. Long answer: yes. @salisan Fuse seems like a lot of overhead for what we want to do. Syscall-Hooking should suffice, as Fuse intercepts syscalls itself (at least I think so). Share this post Link to post Share on other sites
feersum.endjinn 6 Posted May 12, 2005 "Easy" way in linux would be to make a FIFO out of objects.sav with mkfifo() (see man 3 mkfifo) and have separate daemon to listen the other end of pipe and to translate objects.sav writes to whatever external format you want to have. For example you could have your daemon write data into SQL or LDAP database and have multiple OFP servers using same data source... I'll let you use your imagination to possibilities this would offer. This depends on OFP server writing objects.sav all at once everytime it is modified, since I don't think named pipes support seeks... Share this post Link to post Share on other sites
stegman 3 Posted May 12, 2005 Heres one to cook your heads.Is it possible to use the windows clock for ingame play? Â If you can call images or change files durring play shurly you can access windows, get the time, then change OFP mission time with some kind of script in the init file....? Short answer: Yes. Long answer: yes. @salisan Fuse seems like a lot of overhead for what we want to do. Syscall-Hooking should suffice, as Fuse intercepts syscalls itself (at least I think so). ...Really? Cool. How? I'm not a coder, programmer, or anything else (i know the names and file types of scripts used in ofp, but thats about it!). How do you do it? Share this post Link to post Share on other sites
kegetys 2 Posted May 12, 2005 Maybe BIS could finally compile that 1.96a server for Linux too (Windows version was released in July 2004), and without a statically linked glibc so the hook method would work ;) Share this post Link to post Share on other sites
vektorboson 8 Posted May 12, 2005 Allrighty, here is my version of Kegetys TestDLL (I didn't change the filenames...) Please read the README.txt. Functions reference: "\:version:" Â returns version string "\:time:" Â returns your local time "\<sometext" Â appends "sometext" to log.txt in the OFP directory "\|test.txt:sometext" appends "sometext" to test.txt in the OFP directory "\|test.txt?sometext" clears test.txt and writes "sometext" "\*hello" Â returns a string containing an array of chars Ex.: stringarray = call loadfile "\*hello" stringarray will be ["h","e","l","l","o"] testdll.zip 1. REMEMBER: Use it at your own risk. 2. Many credits to Kegetys for the initial DLL and of course DBR_ONIX for his inspiration 3. You need Dev-C++ to compile the source code. (But you don't need to compile it, as there is a precompiled DLL in the zip). Share this post Link to post Share on other sites
DBR_ONIX 0 Posted May 12, 2005 Erm, it is just me, or you (Not specificly you, Vektor') not crediting the 'inspiration' behind this..? [Edit2 : Heheh, thanks ] That aside..nice work, I'll have a look when I get my main PC running again.. stupid unstable peice of s...hhh... technology.. Hmm, even with the commands you've included, the get system time one, has just overcome one OFP limitation, missionstart command not working in SP.. Another idea, how about a FDF.exe type file, that launhes the Hook, and OFP, while passing any parameters to the FLASHPOINTRESISTANCE.exe file, mod folders and nomap etc.. - Ben [Edit : Put Vector instead of Vektor ] Share this post Link to post Share on other sites
hardrock 1 Posted May 12, 2005 Come on, you can't demand credits for something you had an idea about, but which was completely solved and done by others. Imagine everyone doing this Share this post Link to post Share on other sites
DBR_ONIX 0 Posted May 12, 2005 ..erm, I just did Besides, I did put forward the origonal idea, about checking file access times, which basicly lead onto this.. If I knew C I woulda made it my self, but I dont.. Secondly, you don't credit people when you use their ideas? Anyway, all it is a few words, and we're all happy Hmm, I wonder if OFP will run on this PC.. Really want to test this - Ben Share this post Link to post Share on other sites
stegman 3 Posted May 13, 2005 vektorboson; Quote[/b] ]Allrighty,here is my version of Kegetys TestDLL (I didn't change the filenames...) Please read the README.txt. Functions reference: "\:version:" Is this the 'Windows Clock' solution? Share this post Link to post Share on other sites
vektorboson 8 Posted May 13, 2005 vektorboson;Quote[/b] ]Allrighty,here is my version of Kegetys TestDLL (I didn't change the filenames...) Please read the README.txt. Functions reference: "\:version:" Is this the 'Windows Clock' solution? Yes, it's the "\:time" command. Just look into the README, how to use it! Share this post Link to post Share on other sites
hardrock 1 Posted May 13, 2005 Great work, Vektorboson! Do you already have plans to expand it in some way? Will there be a stage when you'll call it final, so scripters may base on it as addon? What about MP compatibility? To have it working in MP games we'd need the version for the Linux server, I assume .. ? Lot's of questions, I hope not too many Share this post Link to post Share on other sites
vektorboson 8 Posted May 13, 2005 Great work, Vektorboson! Do you already have plans to expand it in some way? Will there be a stage when you'll call it final, so scripters may base on it as addon? I don't know whether I'll call it anytime final; it's btw. open source, so anyone can develop it further. And yes, I am expanding it (and changed a bit). I've included a simple Isrunning-query "\:isrunning". It won't trigger a "cannot open file"-message in OFP, if the DLL is not loaded Quote[/b] ]What about MP compatibility? To have it working in MP games we'd need the version for the Linux server, I assume .. ? I don't know? I don't have the ressources to test it in MP, so others are in charge to make it eventually MP compatible. As for the Linux server: I've got a system call hooking module (from a Kernel module tutorial), that loads into the Kernel and intercepts every file-open-query from the Server (and any other application). But the problem is, that this module is in Kernel space and therefore will crash the whole system, if the module crashes. The other problem is, that any applications on the system will be intercepted and this can lead to undesired/unknown effects, and possible performance problems. I'd rather hope that BIS compiles the Linux-server with a dynamically binded Glibc. BIS could release two versions: One with static glibc and one with a dynamically binded glibc. But as I don't do MP, it's up to those who do MP, to ask BIS about it. Share this post Link to post Share on other sites
zyklone 1 Posted May 13, 2005 To have it working in MP games we'd need the version for the Linux server, I assume .. ? I'm working on a method that will work in Linux. Right now it looks like it'll have to be a bit different from Vektorobosons solution. \external\:time: etc instead. (I use a virtual directory) I'd like to make it possible to write scripts to add more functions in perl, python or some similar programming language. I'll post more as things progress. Share this post Link to post Share on other sites
kegetys 2 Posted May 13, 2005 Being bored I ended up further improving my version quite a bit, it now has these functions: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> info version Return script engine version string first str1 str2 Return the index in str2 of the first occurrence of str1, or -1 if str1 is not found. string last str1 str2    Return the index in str2 of the last occurrence of str1, or -1 if str1 is not found. string index string index  Return the character at the specified index. string length string     Return the number of characters in string. string range str i j Return the range of characters in str from i to j. string tolower string    Return string in lower case. string toupper string    Return string in upper case.  string toarray string    Return all characters in string as array elements   file exists name    Return 1 if file fwatcher/mdb/name exists, -1 if not. file write name var val   Write var=val to file fwatcher/mdb/name   file read name var   Read value of var from file fwatcher/mdb/name file vars name      Get array of all vars in file fwatcher/mdb/name file readvars name Get all vars and values from file fwatcher/mdb/name file remove name var Remove a val from file fwatcher/mdb/name file delete name Remove file fwatcher/mdb/name file wget url   Get http URL  input getkeys Return array of all keyboard keys pressed input getkey key Return 1 if key is down, -1 otherwise input getmouse Return mouse state as array [xpos, ypos, left button state, right button state, middle button state] input setmouse x y Set mouse cursor at position x y (Why does this board screw up the code tag like that? ) It also now has a method of checking if fwatch is working, and a small addon that contains a game logic that you can put on a mission to make it not work without fwatch (if fwatch is not installed at all then you get the missing addon error, if it is installed but not working for some reason you get a warning message in mission start that also gets broadcasted to everyone else in a multiplayer game). It seems to work fine on a windows dedicated server too, the only problem is the linux server compatibility... Right now the kernel module method seems to be the only semi-sensible way and I very much doubt many people would want to use something like that as the whole thing would be running in kernel space which is not good, plus you would need root access to install the module... Share this post Link to post Share on other sites
vektorboson 8 Posted May 13, 2005 @Kegeyts Hope you release your version soon, with sourcecode of course  Is there any possibilty to "pump" keystrokes (aka "Putkey")? Share this post Link to post Share on other sites
hardrock 1 Posted May 13, 2005 Great work Kegetys! One question though . . . how performance friendly is this application? Let's assume for example that I query the key state in a 0.1 loop in an ofp script to get the key states, would the heavy transfer between ofp and the application hit on the performance? This would be interesting, since otherwise the key state command is rather useless. I guess file create is included in file write? (create if no exists yet to write to) Otherwise I'd miss this command. This is really exciting, it opens up a lot of new possibilities! With the possible variable savings to files MP games could be saveable, join-in-progress could be implemented and much more! With such guys OFP will surely not die before OFP-2 arrives! Share this post Link to post Share on other sites
kegetys 2 Posted May 13, 2005 Yes I will propably release the source too when I'm happy with the whole thing. Performance seems fine, I tried polling the mouse in every frame with the game running at ~50fps and saw no fps losses caused by it, though the method it uses is not the best one (create a temp file and pass the handle to ofp and then delete it), using a pipe would likely be much better but that didnt seem to work right for some reason when I tried it. But the OS caches the file anyway so I doubt that the file often reaches the actual hard drive before it has already been deleted. Share this post Link to post Share on other sites
Yssabem 0 Posted May 13, 2005 So with thing as they stand now (bearing in mind kegs hasn't released his latest version), do we have the tools to make a MP save addon that records player/AI positions, weapons Ammo etc? In short, can an addon be made now? Is anyone working on it Share this post Link to post Share on other sites
crashdome 3 Posted May 13, 2005 Quote[/b] ]So with thing as they stand now (bearing in mind kegs hasn't released his latest version), do we have the tools to make a MP save addon that records player/AI positions, weapons Ammo etc? In short, can an addon be made now? Is anyone working on it Quote[/b] ]This is really exciting, it opens up a lot of new possibilities! With the possible variable savings to files MP games could be saveable, join-in-progress could be implemented and much more! I swear... it's like we never existed sometimes..... all someone needs to do is search "save MP" in this forum.... SINEWS OF WAR (MP SAVE CONCEPT) YES IT WORKS AND HAS BEEN AROUND SINCE 2003 Regarding saving positions, there is still going to be a large OVERHEAD trying to save that many positions/damage etc.. regardless if you use object.sav OR this system. The only efficient way would be to completely dump the memory and pull out the bits you need. Running a script in OFP to cycle every unit on the map and save it's data would take forever. I should know... we've tried. AND Join in progress is a completely different story and this idea doesn't even come close to solving that issue.... Share this post Link to post Share on other sites