project-navigation
Personal tools

Author Topic: Trunk - usehomedir  (Read 11030 times)

Offline Thyranim

  • Rookie
  • ***
  • Posts: 77
    • View Profile
Trunk - usehomedir
« on: June 24, 2009, 11:21:15 am »
Hi everyone,

first many thanks to all of you for making this game! I've always been a great fan of the x-com series (ok, mainly ufo and tftd ^^ ) and was overjoyed hearing of this project :D


but now to my question...
i've first downloaded the stable release and found the possibility, to force the game to use the basedir to store all data, and not the app-data-dir (vista-user).
now using the dev-release I noticed, that i won't work anymore... is there a reason why?

using "+set fs_usehomedir 0" or "+set basedir" with a relativ path show the same result: all data still saved in app-data :(

Offline Another Guy

  • Squad Leader
  • ****
  • Posts: 239
    • View Profile
Re: Trunk - usehomedir
« Reply #1 on: June 24, 2009, 03:23:21 pm »
I would be very interested in this too.  :D

Offline Tlactar

  • Rookie
  • ***
  • Posts: 60
    • View Profile
Re: Trunk - usehomedir
« Reply #2 on: September 12, 2009, 03:35:22 pm »
me too ;)

It would be great if we could change the directory... that way it would be easier to see if bugs i noticed in one version got fixed in another. And it's simply... a better way to do it :D

Saving stuff in the app dir is one of the worst "innovations" i've seen in windows / games over the last years. It's just not a good idea to force people to save on their system partition ( i know there are ways to move the user directory, but it's a pain in the ass to do so). My system partition is for my system. Nothing else. It's bad enough that windows by default stores user data there (like music, documents etc., i don't use those folders...) but going along with it by saving everything else there, too, is even worse.
(best thing i've seen so far: Sins of a Solar Empire. You even have to put mods (which can be 1gb+) in there. Quite ugly if your system partition was planned to be only for your system...)

In addition: I got most of my games on an external drive so i can take them with me.

So... uhm... at least add an option to change it, please? :D

Offline Destructavator

  • Combination Multiple Specialty Developer
  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 1908
  • Creater of Scorchcrafter, knows the zarakites...
    • View Profile
Re: Trunk - usehomedir
« Reply #3 on: September 13, 2009, 12:58:21 am »
I myself favor games that optionally can be installed in a "portable" manner, I've thought for a long time of trying one of the third-party tools out there that converts a standard app into a portable one, although I've never had the spare time to try it.

I suppose - but don't know for sure - that the NSIS install script could be updated for an option to install the game in a portable manner.

Offline Tlactar

  • Rookie
  • ***
  • Posts: 60
    • View Profile
Re: Trunk - usehomedir
« Reply #4 on: September 28, 2009, 08:02:01 pm »

I suppose - but don't know for sure - that the NSIS install script could be updated for an option to install the game in a portable manner.
Just noticed that for example the Battle for Wesnoth Dev Version's installer gives you that choice... which is really a nice thing to do... :D

Offline criusmac

  • Squad Leader
  • ****
  • Posts: 168
    • View Profile
Re: Trunk - usehomedir
« Reply #5 on: September 28, 2009, 09:32:36 pm »
If I had to venture a guess, and from a quick look in the source code, I'd say the reason is because:

(v2.2.1)
Code: [Select]
void FS_InitFilesystem (void)
{
cvar_t* fs_usehomedir;
const cmdList_t *commands;

Com_Printf("\n---- filesystem initialization -----\n");

for (commands = fs_commands; commands->name; commands++)
Cmd_AddCommand(commands->name, commands->function, commands->description);
fs_usehomedir = Cvar_Get("fs_usehomedir", "1", CVAR_ARCHIVE, "Use the homedir to store files like savegames and screenshots");

/* basedir <path> */
/* allows the game to run from outside the data tree */
fs_basedir = Cvar_Get("fs_basedir", ".", CVAR_NOSET, "Allows the game to run from outside the data tree");

/* start up with base by default */
FS_AddGameDirectory(va("%s/" BASEDIRNAME, fs_basedir->string));

/* then add a '.ufoai/base' directory in home directory by default */
if (fs_usehomedir->integer)
FS_AddHomeAsGameDirectory(BASEDIRNAME);

/* any set gamedirs will be freed up to here */
fs_base_searchpaths = fs_searchpaths;

/* check for game override */
fs_gamedir = Cvar_Get("fs_gamedir", "", CVAR_LATCH | CVAR_SERVERINFO, "If you want to start a mod not located in "BASEDIRNAME);
if (fs_gamedir->string[0])
FS_SetGamedir(fs_gamedir->string);
}

got changed to

(v2.3 dev)
Code: [Select]
void FS_InitFilesystem (qboolean writeToHomeDir)
{
Com_Printf("\n---- filesystem initialization -----\n");

#ifdef PKGDATADIR
/* add the system search path */
FS_AddGameDirectory(PKGLIBDIR"/"BASEDIRNAME);
FS_AddGameDirectory(PKGDATADIR"/"BASEDIRNAME);
#endif

if (writeToHomeDir) {
FS_AddGameDirectory("./" BASEDIRNAME);
FS_AddHomeAsGameDirectory(BASEDIRNAME);
} else {
FS_AddHomeAsGameDirectory(BASEDIRNAME);
FS_AddGameDirectory("./" BASEDIRNAME);
}

#ifdef COMPILE_UFO
FS_InitCommandsAndCvars();
#endif

Com_Printf("using %s for writing\n", FS_Gamedir());
}

But this is just a quick guess that took no more than 3 minutes to find... So, it's hardly researched...

Offline criusmac

  • Squad Leader
  • ****
  • Posts: 168
    • View Profile
Re: Trunk - usehomedir
« Reply #6 on: October 04, 2009, 05:51:45 pm »
Ok, since there's been no responses or offers to look into it:

Would you like me to research this and change the code back in the dev version so that you can set the homedir/basedir as before? Like how the stable version used to do?

<edit> I'm going to start then while I wait for a response. Shouldn't take long, this looks really easy.
« Last Edit: October 04, 2009, 06:05:53 pm by criusmac »

Offline Destructavator

  • Combination Multiple Specialty Developer
  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 1908
  • Creater of Scorchcrafter, knows the zarakites...
    • View Profile
Re: Trunk - usehomedir
« Reply #7 on: October 04, 2009, 06:45:28 pm »
I'll say again that I'm fully behind this idea, exactly what the best way to implement it would be I'm not sure of, though.

Would the choice (normal or portable install) be made with the NSIS installer?  Or would there be a command-line option that changes things so the game would run portable?  The second method would be nice for those of us that don't use an installer because we download and compile from SVN, while the first choice would make sense for normal players downloading an official release and such.  Or I suppose there could be both, I'm really not that familiar with the code...

Offline criusmac

  • Squad Leader
  • ****
  • Posts: 168
    • View Profile
Re: Trunk - usehomedir
« Reply #8 on: October 04, 2009, 06:47:11 pm »
It looks like the changes were very specifically done to remove this ability from the dev version. So, I hesitate on changing it back. Here is the entry and diff that caused it...

Revision 23122 - (view) (download) (annotate) - [select for diffs]
Modified Sat Feb 28 12:07:25 2009 UTC (7 months ago) by tlh2000
File length: 40095 byte(s)
Diff to previous 23105

* removed cvars fs_usehomedir and fs_basedir
* small cleanup




Code: [Select]
*** ufoai/trunk/src/common/files.c 2009/02/28 10:07:23 23105
--- ufoai/trunk/src/common/files.c 2009/02/28 12:07:25 23122
***************
*** 33,42 ****
  #include "../shared/typedefs.h"
  #include "../shared/parse.h"
 
- #ifdef COMPILE_UFO
- static cvar_t *fs_basedir;
- #endif
-
  /** counter for opened files - used to check against missing close calls */
  static int fs_openedFiles;
 
--- 33,38 ----
***************
*** 831,852 ****
  static void FS_InitCommandsAndCvars (void)
  {
  const cmdList_t *commands;
- cvar_t* fs_usehomedir;
 
  for (commands = fs_commands; commands->name; commands++)
  Cmd_AddCommand(commands->name, commands->function, commands->description);
- fs_usehomedir = Cvar_Get("fs_usehomedir", "1", CVAR_ARCHIVE, "Use the homedir to store files like savegames and screenshots");
-
- /* basedir <path> */
- /* allows the game to run from outside the data tree */
- fs_basedir = Cvar_Get("fs_basedir", ".", CVAR_NOSET, "Allows the game to run from outside the data tree");
-
- /* start up with base by default */
- FS_AddGameDirectory(va("%s/" BASEDIRNAME, fs_basedir->string));
-
- /* then add a '.ufoai/VERSION/base' directory in home directory by default */
- if (fs_usehomedir->integer)
- FS_AddHomeAsGameDirectory(BASEDIRNAME);
  }
  #endif
 
--- 827,835 ----
***************
*** 864,874 ****
  FS_AddGameDirectory(PKGDATADIR"/"BASEDIRNAME);
  #endif
 
- #ifdef COMPILE_UFO
- FS_InitCommandsAndCvars();
- #elif COMPILE_MAP
  FS_AddGameDirectory("./" BASEDIRNAME);
  FS_AddHomeAsGameDirectory(BASEDIRNAME);
  #endif
 
  /* any set gamedirs will be freed up to here */
--- 847,857 ----
  FS_AddGameDirectory(PKGDATADIR"/"BASEDIRNAME);
  #endif
 
  FS_AddGameDirectory("./" BASEDIRNAME);
  FS_AddHomeAsGameDirectory(BASEDIRNAME);
+
+ #ifdef COMPILE_UFO
+ FS_InitCommandsAndCvars();
  #endif
 
  /* any set gamedirs will be freed up to here */

Offline criusmac

  • Squad Leader
  • ****
  • Posts: 168
    • View Profile
Re: Trunk - usehomedir
« Reply #9 on: October 04, 2009, 06:57:36 pm »
Well, personally, if I were making the changes, I would make it so that you could change the directory via the command line, like in 2.2.1.

But, this may be since I don't know what a NSIS installer is, and I just download the whole package and go from there.

So, I guess this would be a choice made from ignorance. Still, since I found the revision the changes were made in, we could technically just undo that revision directly, and make sure it behaves in the way it once did...

Or I could just code up a new patch after testing it myself based on the diffs. Probably better if I do it this way.

It still leaves the question, why did tlh2000 remove it in the first place? There is no why in the comments, and the search feature in the forum is too terrible to find any postings about it. (I've tried several times now to find out why, but it isn't working).

Offline Destructavator

  • Combination Multiple Specialty Developer
  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 1908
  • Creater of Scorchcrafter, knows the zarakites...
    • View Profile
Re: Trunk - usehomedir
« Reply #10 on: October 04, 2009, 07:06:26 pm »
It still leaves the question, why did tlh2000 remove it in the first place? There is no why in the comments, and the search feature in the forum is too terrible to find any postings about it. (I've tried several times now to find out why, but it isn't working).

Well, tlh2000 (a.k.a. Mattn), might have removed it because he didn't think anyone would want a feature at the time, and may have just been pruning unused code - I don't really know - Mattn would really have to answer this and I really can't speak for him, but that's my guess.

But, this may be since I don't know what a NSIS installer is, and I just download the whole package and go from there.

The NSIS installer is an open-source utility that compresses the entire fully-built package (ufo.exe, all the dlls, sub-folders, pk3s, etc.), into a single .EXE file for distributing the game.  That's how Odie and myself have made the pre-built downloads.  It runs on a simple script that can be changed in any text editor, the script tells it how to package it, what files/folders to include, and how to un-pack the game when a player downloads the package and wants to install the game.  Right now the script is set to install the game in a default directory and set up the paths and such using the user's APPDATA path - I haven't studied the script in detail so I don't know exactly how it is configured.

The NSIS program also generates an uninstaller for Windows.

NSIS installer script program is also on sourceforge.

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: Trunk - usehomedir
« Reply #11 on: October 04, 2009, 07:18:07 pm »
it was removed because data should not be stored in the program directory - but in the homedir of the user. even microsoft got that idea and was more strict about it in vista already (and hopefully will be even more in further releases)

i understand the issue with the portable apps - so if you want it back, send a patch and i will do it. but keep in mind that the filesystem is stored between ufo and ufo2map - and ufo2map doesn't know anything about cvars.

Offline criusmac

  • Squad Leader
  • ****
  • Posts: 168
    • View Profile
Re: Trunk - usehomedir
« Reply #12 on: October 04, 2009, 08:20:06 pm »
Well, I for one didn't notice where it was saving anything, and after finding out, I don't much care where it is saved either.

Still, from these forums posts, I am finding:

3 users for
1 admin for

1 user doesn't care

1 admin against.

granted, people who don't care probably won't post here anyway, but such is life.

In this case, I have decided I will make the change so that the default will behave the same as it currently does, but the option is present for those who want it to be so. I think it is best to have the option available if you really want to use it since not everyone thinks the same way, despite Microsoft's wishes. While we may all evil for wishing against Microsoft, meh, that's life.

I'll start coding it after I go shopping, so it should be done later today.

Offline criusmac

  • Squad Leader
  • ****
  • Posts: 168
    • View Profile
Re: Trunk - usehomedir
« Reply #13 on: October 04, 2009, 11:03:07 pm »
Mattn's comment about cvars not being understood by ufo2map threw me for a loop as I started initially to study the 4 mains and find a different way to store the program arguments. After a full hour though, I noticed the #ifdefs in the changes, and realized cvars not being understood by ufo2map is not a recent change, and so makes no difference.

I have reverted the files completely based on the diffs, and it compiles fine, but when I try to execute the test run, I get the following problem:

Code: [Select]
---- filesystem initialization -----
Adding game dir: ./base
Added packfile ./base/0base.pk3 (8 files)
Added packfile ./base/0maps.pk3 (402 files)
Added packfile ./base/0materials.pk3 (38 files)
Added packfile ./base/0media.pk3 (10 files)
Added packfile ./base/0models.pk3 (1493 files)
Added packfile ./base/0music.pk3 (40 files)
Added packfile ./base/0pics.pk3 (2267 files)
Added packfile ./base/0shaders.pk3 (12 files)
Added packfile ./base/0snd.pk3 (211 files)
Added packfile ./base/0ufos.pk3 (94 files)
Added packfile ./base/0videos.pk3 (1 files)
Could not load './base/0vids.pk3'
Adding game dir: C:\Documents and Settings\My Name Removed\Application Data\UFOAI/2.3-dev/base
using C:\Documents and Settings\My Name Removed\Application Data\UFOAI/2.3-dev/base for writing
executing default.cfg
couldn't execute config.cfg

----- network initialization -------
libcurl/7.16.4 zlib/1.2.2 initialized.

------ server initialization -------
added 7 maps to the mapcycle

----- console initialization -------
Console initialized.

------- video initialization -------
SDL version: 1.2.13
I: desktop depth: 32bpp
I: video memory: 0
I: video driver: windib
I: setting mode 6:I: set swap control to 0
 1024x768 (fullscreen: no)
I: got 8 bits of stencil
I: got 24 bits of depth buffer
I: got double buffer
I: got 8 bits for red
I: got 8 bits for green
I: got 8 bits for blue
I: got 8 bits for alpha
I: got 0 multisample buffers
GL_VENDOR: ATI Technologies Inc.
GL_RENDERER: Radeon X1600/X1650 Series
GL_VERSION: 2.1.8544 Release
GL_EXTENSIONS: GL_AMD_performance_monitor GL_ARB_depth_texture GL_ARB_draw_buffers GL_ARB_fragment_program GL_ARB_fragment_program_shadow GL_ARB_fragment_shader GL_ARB_framebuffer_object GL_ARB_half_float_pixel GL_ARB_half_float_vertex GL_ARB_map_buffer_range GL_ARB_multisample GL_ARB_multitexture GL_ARB_occlusion_query GL_ARB_pixel_buffer_object GL_ARB_point_parameters GL_ARB_point_sprite GL_ARB_shader_objects GL_ARB_shader_texture_lod GL_ARB_shading_language_100 GL_ARB_shadow GL_ARB_shadow_ambient GL_ARB_texture_border_clamp GL_ARB_texture_compression GL_ARB_texture_cube_map GL_ARB_texture_env_add GL_ARB_texture_env_combine GL_ARB_texture_env_crossbar GL_ARB_texture_env_dot3 GL_ARB_texture_float GL_ARB_texture_mirrored_repeat GL_ARB_texture_non_power_of_two GL_ARB_texture_rectangle GL_ARB_transpose_matrix GL_ARB_vertex_array_object GL_ARB_vertex_buffer_object GL_ARB_vertex_program GL_ARB_vertex_shader GL_ARB_window_pos GL_ATI_draw_buffers GL_ATI_envmap_bumpmap GL_ATI_fragment_shader GL_ATI_meminfo GL_ATI_separate_stencil GL_ATI_texture_compression_3dc GL_ATI_texture_env_combine3 GL_ATI_texture_float GL_EXT_abgr GL_EXT_bgra GL_EXT_blend_color GL_EXT_blend_equation_separate GL_EXT_blend_func_separate GL_EXT_blend_minmax GL_EXT_blend_subtract GL_EXT_compiled_vertex_array GL_EXT_copy_texture GL_EXT_draw_range_elements GL_EXT_fog_coord GL_EXT_framebuffer_blit GL_EXT_framebuffer_multisample GL_EXT_framebuffer_object GL_EXT_gpu_program_parameters GL_EXT_multi_draw_arrays GL_EXT_packed_depth_stencil GL_EXT_packed_pixels GL_EXT_point_parameters GL_EXT_rescale_normal GL_EXT_secondary_color GL_EXT_separate_specular_color GL_EXT_shadow_funcs GL_EXT_stencil_wrap GL_EXT_subtexture GL_EXT_texgen_reflection GL_EXT_texture3D GL_EXT_texture_compression_s3tc GL_EXT_texture_cube_map GL_EXT_texture_edge_clamp GL_EXT_texture_env_add GL_EXT_texture_env_combine GL_EXT_texture_env_dot3 GL_EXT_texture_filter_anisotropic GL_EXT_texture_lod_bias GL_EXT_texture_mirror_clamp GL_EXT_texture_object GL_EXT_texture_rectangle GL_EXT_texture_sRGB GL_EXT_texture_swizzle GL_EXT_vertex_array GL_KTX_buffer_region GL_NV_blend_square GL_NV_texgen_reflection GL_SGIS_generate_mipmap GL_SGIS_texture_edge_clamp GL_SGIS_texture_lod GL_WIN_swap_hint WGL_EXT_swap_control
max texture units: 8
max texture size: detected 4096
but using 2048 as requested
R_LoadProgram: 'world' loaded.
R_LoadProgram: 'mesh' loaded.
R_LoadProgram: 'warp' loaded.
SDL_ttf version 2.0.7 - we need at least 2.0.7

------- sound initialization -------
SDL_mixer version: 1.2.6
... driver: 'dsound'
... audio rate: 44100
... audio channels: 2

------- input initialization -------
0 possible joysticks
no joystick found.

----------- parse scripts ----------

Could not find version string for script files

Unfortunately, reverting my personal code changes made no difference. The error stands, so I'm reasonably sure I didn't do it.

Offline criusmac

  • Squad Leader
  • ****
  • Posts: 168
    • View Profile
Re: Trunk - usehomedir
« Reply #14 on: October 05, 2009, 05:46:10 pm »
Since I can't figure out the error, I'll have to redownload the entire trunk to make sure I have it exactly the way it is supposed to be. A straight update CVS and revert doesn't do a thing for this error, so I'm guessing I'm missing a file or something somewhere. I don't have the bandwidth to do that right now, but I will in a few days. I guess this change is harder than I imagined.

I probably caused the problem by copying my medikit development code and then reverting it via CVS. I thought that would work and save me bandwidth. I guess not. My bad.