• Welcome to PiBoSo Official Forum. Please login or sign up.
 
December 08, 2019, 01:04:07 am

Plugin interface bug/weirdness

Started by HornetMaX, January 04, 2014, 11:08:24 pm

Previous topic - Next topic

HornetMaX

January 04, 2014, 11:08:24 pm Last Edit: January 05, 2014, 12:10:49 pm by HornetMaX
Hi Piboso,

dibu just made me discover that when "compatibility=0" in core.ini, then the "char *_szSavePath" passed in the output plugin interface ("Startup" function) is empty.
This is a bit unexpected, maybe it should just be the path to gpbikes directory (something like "C:\Program Files (x86)\GP Bikes beta4b\gpbikes\").

I could code a terrible hack using GetModuleFileName(), but that would really suck ...

MaX.

PiBoSo

What does the plugin get calling "getcwd"?
"Obviously your ambition outweighs your talent".

HornetMaX

Quote from: PiBoSo on January 05, 2014, 10:01:34 am
What does the plugin get calling "getcwd"?

I more or less solved the issue checking _szSavePath and when it's zero, use ".\\" instead.
Still, it's a bit of a dirty trick.

MaX.

PiBoSo

Quote from: HornetMaX on January 05, 2014, 12:05:04 pm
Quote from: PiBoSo on January 05, 2014, 10:01:34 am
What does the plugin get calling "getcwd"?

I more or less solved the issue checking _szSavePath and when it's zero, use ".\\" instead.
Still, it's a bit of a dirty trick.

MaX.


In theory, no hack should be needed: filepath = _szSavePath + filename
If _szSavePath is empty, the file should automatically be saved in the "gpbikes" directory in the installation folder.
"Obviously your ambition outweighs your talent".

HornetMaX

Quote from: PiBoSo on January 05, 2014, 12:25:03 pm
In theory, no hack should be needed: filepath = _szSavePath + filename
If _szSavePath is empty, the file should automatically be saved in the "gpbikes" directory in the installation folder.

For some reason, it doesn't seem to work. I'm using WritePrivateProfileString to write the .ini and:

  • if gpb was not runned as admin, the file gets created in the correct directory but the function is unable to write in the file.

  • if gpb was runned as admin, the file gets created in c:/windows



Maybe some microsoft quirk/overcomplicated stuff.

MaX.

PiBoSo

Quote from: HornetMaX on January 05, 2014, 02:16:20 pm
Quote from: PiBoSo on January 05, 2014, 12:25:03 pm
In theory, no hack should be needed: filepath = _szSavePath + filename
If _szSavePath is empty, the file should automatically be saved in the "gpbikes" directory in the installation folder.

For some reason, it doesn't seem to work. I'm using WritePrivateProfileString to write the .ini and:

  • if gpb was not runned as admin, the file gets created in the correct directory but the function is unable to write in the file.

  • if gpb was runned as admin, the file gets created in c:/windows



Maybe some microsoft quirk/overcomplicated stuff.

MaX.


To work around the Microsoft functions, it is possible to use _getcwd if _szSavePath is empty.
"Obviously your ambition outweighs your talent".

HornetMaX

Quote from: PiBoSo on January 05, 2014, 02:59:22 pm
To work around the Microsoft functions, it is possible to use _getcwd if _szSavePath is empty.

Yeah, probably better than my ".\\" hack.

MaX.