• Welcome to PiBoSo Official Forum. Please login or sign up.
 
April 18, 2024, 10:28:26 AM

News:

GP Bikes beta21c available! :)


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"?
"La perfezione non è il nostro obiettivo, è la nostra tendenza".

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.
"La perfezione non è il nostro obiettivo, è la nostra tendenza".

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.
"La perfezione non è il nostro obiettivo, è la nostra tendenza".

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.