Author Topic: Errors with SAVEs and User config environment issue  (Read 8722 times)

Offline vinxx

  • Sergeant
  • **
  • Posts: 12
    • View Profile
Errors with SAVEs and User config environment issue
« on: February 09, 2019, 07:05:17 pm »
Hello everybody,
Thank you for supporting that interesting project, game was played thousand times in 90s and still playable for now...
Appreciating for your time you makes things easier on modern terms...

I am having a two main issues here beginning after I moved game on macOS X Mojave.
Initially I used a Windows XP as a guest in Parallels Desktop on my macOS X Mavericks and its was run well (openxcom_git_master_2018_12), then decide install a native port after updating to macOS X Mojave on it (openxcom_git_master_2019_02_04_1901).
As result it was installed and running well as it is, but I having issues and basically playing with some settings and reading a manual is not help me to understand what to do to resolve.

I . Quick SAVE files done on Windows XP version of OpenXcom is not possible to load on macOS X Mojave version and always got an error on loading it:

Code: [Select]
[09-02-2019_19-40-44] [ERROR] yaml-cpp: error at line 0, column 0: bad conversion
it is happen on AUTOBATTLESCAPE SAVE and QUICKSAVE, GLOBE SAVE is possible to load successfully. 

II. I have configured $XDG_ in ~/.bash_profile
but when loading a game through clicking an OpenXcom.App it is still looking user config files in $HOME/Library/Application Support/OpenXcom and creating that folder and files in it if it is removed.
(even if $XDG_DATA_HOME is defined)
if I make a bash script and it is working well, game loads settings properly in this case, but I want to click an App in LaunchPad not through .sh script

~/.bash_profile
Code: [Select]
export XDG_DATA_DIRS=~/Games
export XDG_CONFIG_HOME=~/Games
export XDG_DATA_HOME=~/Games

openxcom.sh in the ~/Games/openxcom
Code: [Select]
#!/bin/bash
#
#~/Games/openxcom/openxcom.app/Contents/MacOS/openxcom -data "$XDG_DATA_DIRS/openxcom" -user "$XDG_DATA_HOME/openxcom" -config "$XDG_CONFIG_HOME/openxcom"
~/Games/openxcom/openxcom.app/Contents/MacOS/openxcom


openxcom.log when run through .sh script
Code: [Select]
[09-02-2019_19-40-09] [INFO] Data folder is:
[09-02-2019_19-40-09] [INFO] Data search is:
[09-02-2019_19-40-09] [INFO] - /Users/user/Games/openxcom/
[09-02-2019_19-40-09] [INFO] - /Users/user/Games/openxcom/
[09-02-2019_19-40-09] [INFO] - /Users/Shared/OpenXcom/
[09-02-2019_19-40-09] [INFO] - ./
[09-02-2019_19-40-09] [INFO] User folder is: /Users/user/Games/openxcom/
[09-02-2019_19-40-09] [INFO] Config folder is: /Users/user/Games/openxcom/
[09-02-2019_19-40-09] [INFO] Options loaded successfully.
[09-02-2019_19-40-09] [INFO] SDL initialized successfully.
[09-02-2019_19-40-10] [INFO] SDL_mixer initialized successfully.
[09-02-2019_19-40-10] [INFO] requested file not found: openxcom.png
[09-02-2019_19-40-10] [INFO] Attempting to set display to 1280x800x8...
[09-02-2019_19-40-11] [INFO] Display set to 1280x800x8.
[09-02-2019_19-40-11] [INFO] Loading data...
[09-02-2019_19-40-11] [INFO] Scanning standard mods in 'standard'...
[09-02-2019_19-40-11] [INFO] Scanning user mods in '/Users/user/Games/openxcom/mods'...
[09-02-2019_19-40-11] [INFO] Mapping resource files...
[09-02-2019_19-40-11] [INFO] Resources files mapped successfully.
[09-02-2019_19-40-11] [INFO] Loading rulesets...
[09-02-2019_19-40-14] [INFO] Loading fonts... Font.dat
[09-02-2019_19-40-14] [INFO] Loading extra resources from ruleset...
[09-02-2019_19-40-15] [INFO] Data loaded successfully.
[09-02-2019_19-40-15] [INFO] Loading language...
[09-02-2019_19-40-15] [INFO] Language loaded successfully.
[09-02-2019_19-40-15] [INFO] OpenXcom started successfully!
[09-02-2019_19-40-15] [INFO] Using software scaling routine. For best results, try an OpenGL filter.
[09-02-2019_19-40-31] [INFO] Mapping resource files...
[09-02-2019_19-40-31] [INFO] Resources files mapped successfully.
[09-02-2019_19-40-31] [INFO] Attempting to set display to 1280x800x8...
[09-02-2019_19-40-31] [INFO] Display set to 1280x800x8.
[09-02-2019_19-40-31] [INFO] SDL_mixer initialized successfully.
[09-02-2019_19-40-31] [INFO] Loading data...
[09-02-2019_19-40-31] [INFO] Scanning standard mods in 'standard'...
[09-02-2019_19-40-31] [INFO] Scanning user mods in '/Users/user/Games/openxcom/mods'...
[09-02-2019_19-40-31] [INFO] Mapping resource files...
[09-02-2019_19-40-31] [INFO] Resources files mapped successfully.
[09-02-2019_19-40-31] [INFO] Loading rulesets...
[09-02-2019_19-40-35] [INFO] Loading fonts... Font.dat
[09-02-2019_19-40-35] [INFO] Loading extra resources from ruleset...
[09-02-2019_19-40-35] [INFO] Data loaded successfully.
[09-02-2019_19-40-35] [INFO] Loading language...
[09-02-2019_19-40-35] [INFO] Language loaded successfully.
[09-02-2019_19-40-35] [INFO] OpenXcom started successfully!
[09-02-2019_19-40-44] [ERROR] yaml-cpp: error at line 0, column 0: bad conversion

openxcom.log when run through OpenXcom.app
Code: [Select]
[09-02-2019_19-58-56] [INFO] Data folder is:
[09-02-2019_19-58-56] [INFO] Data search is:
[09-02-2019_19-58-56] [INFO] - /Users/user/Library/Application Support/OpenXcom/
[09-02-2019_19-58-56] [INFO] - /Users/Shared/OpenXcom/
[09-02-2019_19-58-56] [INFO] - ./
[09-02-2019_19-58-56] [INFO] User folder is: /Users/user/Library/Application Support/OpenXcom/
[09-02-2019_19-58-56] [INFO] Config folder is: /Users/user/Library/Application Support/OpenXcom/
[09-02-2019_19-58-56] [INFO] Options loaded successfully.
[09-02-2019_19-58-56] [INFO] SDL initialized successfully.
[09-02-2019_19-58-56] [INFO] SDL_mixer initialized successfully.
[09-02-2019_19-58-56] [INFO] requested file not found: openxcom.png
[09-02-2019_19-58-56] [INFO] Attempting to set display to 640x400x8...
[09-02-2019_19-58-56] [INFO] Display set to 640x400x8.
[09-02-2019_19-58-56] [INFO] Loading data...
[09-02-2019_19-58-57] [INFO] Scanning standard mods in 'standard'...
[09-02-2019_19-58-57] [INFO] Scanning user mods in '/Users/user/Library/Application Support/OpenXcom/mods'...
[09-02-2019_19-58-57] [INFO] Mapping resource files...
[09-02-2019_19-58-57] [INFO] Resources files mapped successfully.
[09-02-2019_19-58-57] [INFO] Loading rulesets...
[09-02-2019_19-59-00] [INFO] Loading fonts... Font.dat
[09-02-2019_19-59-00] [INFO] Loading extra resources from ruleset...
[09-02-2019_19-59-00] [INFO] Data loaded successfully.
[09-02-2019_19-59-00] [INFO] Loading language...
[09-02-2019_19-59-00] [INFO] Language loaded successfully.
[09-02-2019_19-59-00] [INFO] OpenXcom started successfully!
[09-02-2019_19-59-00] [INFO] Playing flx, 320x200, 200 frames
[09-02-2019_19-59-00] [INFO] Using software scaling routine. For best results, try an OpenGL filter.

Offline R1dO

  • Colonel
  • ****
  • Posts: 442
    • View Profile
Re: Errors with SAVEs and User config environment issue
« Reply #1 on: February 09, 2019, 07:44:24 pm »
Not sure how it works on macOS, but normally bash does not expand the tilde when assigned to a variable.

See also this stackoverflow question

E.g. You have specified a (non-existing) folder
Code: [Select]
/~/Games While you probably want
Code: [Select]
/home/username/Games
Easy fix would be replacing
Code: [Select]
~/ with $HOME/
Be warned though, many more applications pickup those XDG_* directories so your approach will probably give some weird results with other software.
May i ask why you do not want to use the default location under ~/.local/share ?

Offline Stoddard

  • Colonel
  • ****
  • Posts: 485
  • in a fey mood
    • View Profile
    • Linux builds & stuff
Re: Errors with SAVEs and User config environment issue
« Reply #2 on: February 09, 2019, 08:29:22 pm »
Not sure how it works on macOS, but normally bash does not expand the tilde when assigned to a variable.

Logs show that the tilda was expanded all right, that's not the problem.

re I - Battlescape saves are not guaranteed to load on a different version, although the exact error looks unfamiliar.


Offline vinxx

  • Sergeant
  • **
  • Posts: 12
    • View Profile
Re: Errors with SAVEs and User config environment issue
« Reply #3 on: February 09, 2019, 09:15:25 pm »
seems tilda is well on macOS
Code: [Select]
MBP:~ user$ > echo $XDG_DATA_DIRS
/Users/user/Games
anyway, i have changed all three variable and try point to $HOME/Games, result is same...
Game does't read them when starting through App in GUI...
attention to just this: when starting unix-executive though CLI then it is read $XDG_ properly 
Code: [Select]
MBP:~ user$ >~/Games/openxcom/openxcom.app/Contents/MacOS/openxcom
or
Code: [Select]
MBP:~ user$ > /Users/user/Games/openxcom/openxcom.app/Contents/MacOS/openxcom
the same app starts in GUi and it is read the default and didn't see $XDG_ variables set up globally

II.
Logs show that the tilda was expanded all right, that's not the problem.

re I - Battlescape saves are not guaranteed to load on a different version, although the exact error looks unfamiliar.

need to update yaml-cpp? I afraid it can mess some files and crush runtime later...

Offline Stoddard

  • Colonel
  • ****
  • Posts: 485
  • in a fey mood
    • View Profile
    • Linux builds & stuff
Re: Errors with SAVEs and User config environment issue
« Reply #4 on: February 09, 2019, 09:21:28 pm »
Game does't read them when starting through App in GUI...
attention to just this: when starting unix-executive though CLI then it is read $XDG_ properly 
Code: [Select]
MBP:~ user$ >~/Games/openxcom/openxcom.app/Contents/MacOS/openxcom
or
Code: [Select]
MBP:~ user$ > /Users/user/Games/openxcom/openxcom.app/Contents/MacOS/openxcom
the same app starts in GUi and it is read the default and didn't see $XDG_ variables set up globally


This only means they are not set globally enough. As in the .app does not see them.
 I'm no expert on OSX and no hardware to test it is nearby.

Quote
II.
need to update yaml-cpp? I afraid it can mess some files and crush runtime later...

I doubt it's in any way yaml-cpp's fault. Post the save in question here if you don't mind.

Offline vinxx

  • Sergeant
  • **
  • Posts: 12
    • View Profile
Re: Errors with SAVEs and User config environment issue
« Reply #5 on: February 09, 2019, 09:31:16 pm »
all the battle saves not loading with this error, attached one
it is TFTD

Offline vinxx

  • Sergeant
  • **
  • Posts: 12
    • View Profile
Re: Errors with SAVEs and User config environment issue
« Reply #6 on: February 09, 2019, 09:40:16 pm »
This only means they are not set globally enough. As in the .app does not see them.
 I'm no expert on OSX and no hardware to test it is nearby.

that's strange... even setenv/printenv shows it is gobally known vars:

Code: [Select]
MBP:~ user$ > printenv
MANPATH=/opt/local/share/man:
TERM_PROGRAM=Apple_Terminal
XDG_DATA_HOME=/Users/user/Games
SHELL=/bin/bash
TERM=xterm-256color
TMPDIR=/var/folders/h1/sb_h449j1zqbpwtvrccy7l000000gn/T/
Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.DqWYHU58j0/Render
TERM_PROGRAM_VERSION=421.1
TERM_SESSION_ID=5A24FD85-CC50-4FB9-9502-82F2154B6F49
USER=user
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.c0jlfJG7Zv/Listeners
PATH=/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/user/.scripts
PWD=/Users/user
EDITOR=/usr/bin/nano
XPC_FLAGS=0x0
PS1=\h:\W \u$ >
PS2=>
XPC_SERVICE_NAME=0
SHLVL=1
HOME=/Users/user
XDG_CONFIG_HOME=/Users/user/Games
LOGNAME=user
VISUAL=/Applications/TextEdit.app/Contents/MacOS/TextEdit
XDG_DATA_DIRS=/Users/user/Games
MP_EDITOR=/usr/bin/nano
LC_CTYPE=UTF-8
SECURITYSESSIONID=186a8
_=/usr/bin/printenv

Offline Stoddard

  • Colonel
  • ****
  • Posts: 485
  • in a fey mood
    • View Profile
    • Linux builds & stuff
Re: Errors with SAVEs and User config environment issue
« Reply #7 on: February 09, 2019, 10:04:01 pm »
all the battle saves not loading with this error, attached one
it is TFTD



That one, right? No problems loading, though that's some random OpenXcom Extended version I had around at the moment. You can maybe try running it, without extra mods it's indistinguishable from non-Extended.


that's strange... even setenv/printenv shows it is gobally known vars:

That's what I meant, those vars are global for the shell all right, but do not reach the .app which runs in some other environment likely.  Here I can't help you.

Offline hellrazor

  • Commander
  • *****
  • Posts: 2027
  • Deep Ruleset Digger & Bughunter
    • View Profile
    • Github Account
Re: Errors with SAVEs and User config environment issue
« Reply #8 on: February 10, 2019, 04:02:04 am »
This might help:

https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

Also please check what our version of yaml-lib is just to be sure.

It is MacOs, sorry no pity from me for Apple Users. You brought this pain too yourself.

The savegame file loads for me fine under Linux, using the latest nightly version from github.
« Last Edit: February 10, 2019, 04:11:30 am by hellrazor »

Offline R1dO

  • Colonel
  • ****
  • Posts: 442
    • View Profile
Re: Errors with SAVEs and User config environment issue
« Reply #9 on: February 10, 2019, 08:47:09 pm »
There is no need to be harsh on users that prefer different operating systems.

Problem here is that this community does not have that many macOS developers making it harder to solve these kind of problems.
Besides that, it does not help that Apple has changed the behavior for GUI application starters and the way to influence these variables quite a lot over the past few releases (judging from the amount of internet topics/posts).
From what i understand the current situation is that each app is sandboxed and there is no easy way to set per user login variables.

So unless some knowledgeable apple developer gives you the appropriate advice the best thing i can offer is some (dirty) workarounds for you to try:

1. Edit the contents of the app itself (plist perhaps?) so that its calling parameters point to your preferred "/Users/user/Games/openxcom/" folder.
  - This can be painful since you probably have to do it on each update of the app.
2. Create a symbolic link so that "/Users/Shared/OpenXcom/" points to "/Users/user/Games/openxcom/".

Good luck with it

Note: I am a linux user myself, so take any advice with a big grain of salt.

Offline Stoddard

  • Colonel
  • ****
  • Posts: 485
  • in a fey mood
    • View Profile
    • Linux builds & stuff
Re: Errors with SAVEs and User config environment issue
« Reply #10 on: February 10, 2019, 11:57:33 pm »
Yeah, true. Without dedicated apple hardware those builds are shots in the dark - no way to test, no way to troubleshoot, no nothing.

Installing a VirtualBox image is not the real thing. And a second-hand real thing costs upwards of $500, so .. unless someone comes up with hardware (able to run Mojave) or cash, that's where it stays. At "We are glad it even runs".

Offline vinxx

  • Sergeant
  • **
  • Posts: 12
    • View Profile
Re: Errors with SAVEs and User config environment issue
« Reply #11 on: February 11, 2019, 09:13:44 pm »
ok, thank you everybody...
I was just ask for maybe somebody can provide a quick advice...
Anyway it is runnable through script, later maybe I will use Automator to build an App covering this issue with environment parameters
« Last Edit: February 13, 2019, 11:51:13 pm by vitaly »

Offline vinxx

  • Sergeant
  • **
  • Posts: 12
    • View Profile
Re: Errors with SAVEs and User config environment issue
« Reply #12 on: February 16, 2019, 11:30:04 pm »
There is no need to be harsh on users that prefer different operating systems.

Problem here is that this community does not have that many macOS developers making it harder to solve these kind of problems.
Besides that, it does not help that Apple has changed the behavior for GUI application starters and the way to influence these variables quite a lot over the past few releases (judging from the amount of internet topics/posts).


So, that's why there are build for macOS X making not so often as a normal one for Windows versions?
Last one is dev 20180720 as I found here on the forum...

I have packed that build for macOS X for community of the rutracker.org and put .dmg on it
It is consist of course with original vanilla data files of the games.
.icns icons made for macOS X with Retina display supported (@2x) I can put here for later use, but don't know where to
And am I right that it is not welcome to put links here on forum for torrent files consist of original game versions? or allowed to?
thanks

« Last Edit: February 16, 2019, 11:34:52 pm by vinxx »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9091
    • View Profile
Re: Errors with SAVEs and User config environment issue
« Reply #13 on: February 17, 2019, 12:28:32 am »
So, that's why there are build for macOS X making not so often as a normal one for Windows versions?
Last one is dev 20180720 as I found here on the forum...

I make a .dmg of OpenXcom Extended for OSX at least once a month.
Last is from 20190211, can be found here: https://openxcom.org/forum/index.php/topic,5258.0.html