After the good news that SDK 1.9 is (supposed to be) OSX compatible, I had a whack at testing one of the example plugins (telemetry_position.so). It didn't work. It fails so silently that I'm not sure how to proceed. (I posted this question to github also. Am x-posting this here because the github thread is old and quiet.) Here's the story so far:
I did manage to compile the example telemetry_position.so (this is what I am mostly interested in). I then tracked down the game binary and created a plugins dir in the same dir, which under OSX is a mouthful:
Code: Select all
/Volumes/DATA/Users/MY_USERNAME/Library/Application\ Support/Steam/steamapps/common/Euro\ Truck\ Simulator\ 2/Euro\ Truck Simulator\ 2.app/Contents/MacOS
I started the game. I got a warning popup saying that I'm attempting to invoke advanced SDK features, which seemed like a good sign. Also, in the game log, I saw an ack that the .so has been loaded (or at least an attempt has been made to load it):
Code: Select all
00:00:04.002 : loading 'telemetry_position' '/Volumes/DATA/Users/de/Library/Application Support/Steam/steamapps/common/Euro Truck Simulator 2/Euro Truck Simulator 2.app/Contents/MacOS/plugins/telemetry_position.so'
I get no error messages from this load. However, I also get no telemetry log file after quitting the game. I do get an unload confirmation message during the shutdown:
Code: Select all
00:12:47.086 : unloaded 'telemetry_position'
I thought perhaps the opened file was not being closed properly at exit, so I took out the "ifdef linux" near the end of the telemetry_position.cpp source, which I thought might enable finish_log properly for the OSX environment; so I hope the log file is being closed after writing. However I have also loaded the plugin and driven the truck around a bit, then left the truck parked and looked for the telemetry log file with the game still open: no sign of it. I don't think the file is ever being opened.
The .so opens its log file with a simple
Code: Select all
log_file = fopen("telemetry_position.log", "wt");
which doesn't give much of a clue as to
where this file will be created. Rather than have to rummage, I tried editing this fopen command to specify the file name as
but still I got no telem log file in /tmp after starting and then exiting the game. Or while running.
Even if no position logging is done, the .so should write one line to the log file immediately after opening it:
Code: Select all
fprintf(log_file, "Log opened\n");
So I was expecting to find at least a stub output file with this one line in it. It's discouraging to get such a silent failure; seems to augur badly for debugging, 'cos if I can't write debug msgs to a log file ... you see the problem... I'm beginning to think that the init function for the plugin is never getting called but I have no idea how to determine this or how to fix it if so. If I knew the function call to write to the devcon, then I might be able to do some debug using the
command (which I've tried btw -- didn't seem to do anything, just executed with no error, silence). But I have no idea what the syntax is for writing to dev con from ets2 cpp source. If anyone has example code for this I'd sure like to see it!
So right now I have a .so that loads -- apparently w/o error -- but does nothing, with no error message or any indication of what has failed or how. help...?