PiBoSo Official Forum

GP Bikes => Mods => Plugins => Topic started by: HornetMaX on January 04, 2014, 11:08:24 PM

Title: Plugin interface bug/weirdness
Post by: HornetMaX on January 04, 2014, 11:08:24 PM
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.
Title: Re: Plugin interface bug/weridness
Post by: PiBoSo on January 05, 2014, 10:01:34 AM
What does the plugin get calling "getcwd"?
Title: Re: Plugin interface bug/weirdness
Post by: 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.
Title: Re: Plugin interface bug/weirdness
Post by: PiBoSo on January 05, 2014, 12:25:03 PM
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.
Title: Re: Plugin interface bug/weirdness
Post by: 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:
Maybe some microsoft quirk/overcomplicated stuff.

MaX.
Title: Re: Plugin interface bug/weirdness
Post by: PiBoSo on January 05, 2014, 02:59:22 PM
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.
Title: Re: Plugin interface bug/weirdness
Post by: HornetMaX on January 05, 2014, 03:47:45 PM
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.