Ingamechat read(log) / write "bridge" to use with other tools?
-
I thought it should be UTF-16, 2 bytes, for covering most languages?
-
StarTrader wrote:
I thought it should be UTF-16, 2 bytes, for covering most languages?offtopic :
Not exactly. The way i understand it Unicode is this kinda ‘virtual’ characters table (Unicode != UTF16).
And in practice it is represented in transformation formats (UTFs), where number shows minimal amount of bits per character. But it could use more than that. For instance, Cyrillic letters use 2 bytes in utf8.
So any UTF can represent full Unicode space, as i understand it. -
With this new chatlog.dll you can log chinese and russian so I think all languages will work with it
I was playing a bit to create an Translator for Freelancerchat using the google ajax, thats why i was asking for utf-8 support.
It works now translation isnt perfect all the time but much better then nothing
Its also possible to translate with an command single words ingame.
Now just one thing is missing. At the moment I use an dx overlay to show translation ingame but it does not work well with all graphic cards some get low fps cause of it :(.So I ask if you adoxa can make me happy again and write me an dll that read a textline from a file and then put it with a hook into freelancerchat like this:
I dont need to send it to server just put it to the Freelancerchatlog in the game maybe with color change support if this is possible.If that would possible i could complete my Freelancer Translationplugin to make it easyer for player to understand foreign languages and to write in foreign languages
-
Not entirely just sure what you want, but find [d]attached[/d] how I interpreted it. It will detect changes to EXE\externalmsg.txt and add them to the chat output window. It assumes the file is in UTF-8 (BOM optional) and only one line is written each update (although adding multiple lines shouldn’t be hard). It uses STYLE_EXTERNAL, so define it in DATA\FONTS\rich_fonts.ini and choose your own color (you might also like to make it italic).
-
Hm I have one problem, I tryed now many hours to find an solution but none of my solutions realy worked
The problem is after I write one time into externalmsg.txt the file is blocked by Freelancer and im not able to write into it again until u unlock it manually.
I also tryed to add
remove(“externalmsg.txt”);
after it writes into Freelancer chat but its just dirty solution and it doesnt work well.
Afte some time it get not longer deleted and old problem that im not able to write into the file start again.
Do you have any ideas how to solve that issue?
Maybe use registry instead of externalmsg.txt would work better? although I dont know how to do this[Edit]
I tried now this, I added
if( _unlink( “externalmsg.txt” ) == -1 )
return;after
fclose( file );
If seams that it fixed the problem that I was not able to write into externalmsg.txt.
But now an other problem occur which has nothing to do with my changes. It also random crash with your dll if I write to fast to many data into externalmsg.txt I get this crash:
http://www.imagebanana.com/view/eslvll36/error.jpg[Edit2]
Im not shure but it seams tab into game and out during it write into chatlog result faster in a crash…Any Ideas?
-
If you’re creating the file each time, replace ReadDirectoryChangesW with the synchronous version - replace “&overlapped, Modified” with “NULL, NULL” and remove the time flag. Replace SleepEx with a call to Modified and remove everything in the condition except the last two lines. Depending on how you’re writing to externalmsg.txt, it might also be an idea to deny read on it, forcing the dll to wait for it to become available.
In my limited testing using a redirected echo, there was no problem with locks. However, I didn’t have ChatLog running, as well.
If your main focus is on translation, I would do away with ExternalMsg altogether and do it all in ChatLog. Have ChatLog call/execute the translator and receive/wait for the translation, then append to (or replace) the current message.
-
Hm until I can think about to fix the problems to write into the externalmsg.txt it must run without crash
I used this batch script with redirected echo to externalmsg.txt
http://ul.to/b0ix0u
and the original dll from you after short time of running the batch file Freelancer crash in most cases with this message:
http://www.imagebanana.com/view/ih7hv4u1/crash.jpg
commom.dll from Freelancer - Patch v1.1 (international)
And this time no chatlog.dlls
Im not shure if this help but some time I check what process is accessing the externalmsg.txt I noticed that Freelancer access it many time:
http://www.imagebanana.com/view/ydsbx5sr/unlocker.jpg
For me it looks not normal maybe you know more about^^
Its not every time but I saw it the most time before Freelancer crashed.I have no idea whats the reason for the crash maybe its not possible to fix just you may know how but until it crash like this I cant realy use it
The reason I dont use one dll with all is
1. my C/C++ knowledge is very low I understand only part of your suggestions to change the code for creating the file each time…I know shame on me but I just started to lern but I prefer simpler programming/script languages.2. I want to send not only translations into chat if it work.
Translator was 1 reason but I have other Ideas how to use this feature if it will work without crash -
Many thanks for your help again
File write access isnt longer a problem with the new version.But the problem that it crash short time after test.bat is started still exist.
Its still 000c9n86 common.dll in most cases
http://www.imagebanana.com/view/ih7hv4u1/crash.jpg
Some time its 000c9b89 common.dll
As lower the sleep time in the test.bat as faster comes the crash
I also tested how it work when I just let Translator run.
It works fine for some time but then
crash at 000118b5 ntdll.dll when I pressed F1 and try to switch a char in Freelancer.Do you have crash too if you test with test.bat ?
Or do you have an Idea how to fix the crash problem?