| |
spider-j
Registered: Oct 2004 Posts: 445 |
Release id #216054 : GTUltra V1.0.3
Better take this to discussions to not flood the comments.
Quote:Can you run it from the win32 folder?
Running the exe through WINE works fine. I'd prefer a native linux build though. |
|
... 159 posts hidden. Click here to view all posts.... |
| |
Jason Page
Registered: Sep 2015 Posts: 87 |
I'm sure it will be failing in the loadPalettes() method.
It checks to see if the gtpalette folder exists, and then gets the files in that folder via readdir, builds a final file path.
This then calls loadPalette(char *paletteName)
this loads the palette file and then calls readPaletteData(paletteMem); - which runs through the loaded data and sets RGB
readPaletteData is also called when loading the default palette - So this bit works. It has to be the file loaded - or how it's failing to find either the gtpalette folder or its contents where the problem is |
| |
tlr
Registered: Sep 2003 Posts: 1714 |
This happens: $ gtultra
Unable to read directory: No such file or directory
$ (regardsless of where I'm standing) |
| |
Jason Page
Registered: Sep 2015 Posts: 87 |
So, that's in loadPalettes, as suspected:
createFilename(appFileName, paletteFile, "gtpalettes");
folder = opendir(paletteFile);
if (folder == NULL)
{
jdebug[0] = 0xff;
perror("Unable to read directory");
It works for windows (or at least, for me and Lman!)
maybe for linux, it needs another "\" at the end of "gtpalettes"? |
| |
tlr
Registered: Sep 2003 Posts: 1714 |
did a little printf() debugging, appFileName is '/home/tlr/.goattrk/gtultra.cfg' on my system... |
| |
Jason Page
Registered: Sep 2015 Posts: 87 |
createFilename looks backwards through that string until it finds a / or \. It then and adds the new filename (or folder) at that point (basically, replacing the gtultra.cfg text with the new string)
Changing the perror to the following show show the folder it's trying to open..
perror(paletteFile); |
| |
Jason Page
Registered: Sep 2015 Posts: 87 |
printf does nothing when i'm using windows cmd window to build - which is the reason that debugging this whole thing has been a f**king nightmare! |
| |
tlr
Registered: Sep 2003 Posts: 1714 |
Quote: printf does nothing when i'm using windows cmd window to build - which is the reason that debugging this whole thing has been a f**king nightmare!
Yes, windows is usually resisting development activities. :)
But, point being is that appFileName is not used as appFileName, it is used as cfgFileName, hence you will search the palettes relative to where the configuration file is located. Place gtpalettes/ in $HOME/.goattrk/ and it will work using the current code.
EDIT: then it loads them, but switching does seem to work anyway... ? |
| |
Jason Page
Registered: Sep 2015 Posts: 87 |
>Yes, windows is usually resisting development activities. :)
I'm a bit of a dick. I piped the output to a file, and I can see printf's... I'll be doing that more from now on!
I'm a bit confused!...
>But, point being is that appFileName is not used as appFileName, it is used as cfgFileName, hence you will search the palettes relative to where the configuration file is located.
Yes - the gtpalette folder should be within the same folder as gtUltra.exe AND the .cfg file.. Which is why the createfile code removes the gtultra.cfg and replaces it with gtpalette.. And then from there it adds "/"+filename of palette[n] to load each one..
That's what should happen - and it does under windows. |
| |
tlr
Registered: Sep 2003 Posts: 1714 |
Quoting Jason PageYes - the gtpalette folder should be within the same folder as gtUltra.exe AND the .cfg file.. Which is why the createfile code removes the gtultra.cfg and replaces it with gtpalette.. And then from there it adds "/"+filename of palette[n] to load each one..
That's what should happen - and it does under windows.
The config file is under $HOME/.goattrk/ on linux as it has always been. The binary isn't in the same directory. dirname(cfgFileName) != dirname(appFileName) for all platforms.
But, it still doesn't work if I copy it there. There are several issues. You still got a "\\" in loadPalettes(). You do "rb" of the palette (a text file) in loadPalette() and the hand parse that in readPaletteData() which is bound to fail on some configurations (CR/LF vs LF for instance). |
| |
Jason Page
Registered: Sep 2015 Posts: 87 |
I wasn't aware that the cfg wasn't in the same location as the exe in linux...hmm
I do rb, as the default file is stored as binary in the large datafile. So reading the text file should be taken care of, once it actually loads into RAM.
I do a check for LF, etc - it's the code that I use to parse the default palette, which I modified to work with the binary data (it doesn't check for "\n", for example - it checks for 0xd... But we're going off track, I think.. take a look at sgets - I added a comment when I wrote it:
/*
Had to modify this to handle \n manually due to not being able to open "rt".
I add a 0 at the end of the loaded file buffer as a terminator.
I then check for <=0xd for a carriage return to cover 0xd,0xa combinations, rather than =='\n'
*/
This is what I get when running on windows: So the parsing of the binary works.
https://www.dropbox.com/s/ks63dxl2hx1q159/GoatTracker%20Ultra%2.. |
Previous - 1 | ... | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 - Next |