From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-io0-f175.google.com ([209.85.223.175]) by ur; Wed Jul 29 12:11:15 EDT 2015 Received: by iodd187 with SMTP id d187so26326422iod.2 for <9front@9front.org>; Wed, 29 Jul 2015 09:11:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=kaW7rVyxSZVwSuicqdjDHgQIyQNC1Ifb/v8CJtzHyFE=; b=OcYymTktisYcSQ5SfrgXGwk9gAUx4BFcyATc8wtiB3ZkmFJQDuzMVuEZXoGZ2rEiGf pcoOLoSVGZ6BtvY9qKEh0/cjhjwxbaPNvOf2CE0UEiHVn4wslQghm41tyzUHEjESUi+J yjsL0VgVmGpPTu2b/424rmYXrsYZvvM1eo4685EGX6SXsergTfJxaSw6tt3ahCiF7nLL o8uVJXZI6KerFZKlQXFGul87Jm7DVuNhnyv6o52MJeBoFz24w7DNDR+1tun+OeavTfYH c0Vrx3T3ZXQR4oO4X7I2sEFY/0OIStOfvcqcYRSs6EwHeEvwzjpDCZuyLEycI3c/Nqqg 0bCQ== MIME-Version: 1.0 X-Received: by 10.107.5.149 with SMTP id 143mr3220893iof.109.1438186274992; Wed, 29 Jul 2015 09:11:14 -0700 (PDT) Received: by 10.107.56.68 with HTTP; Wed, 29 Jul 2015 09:11:14 -0700 (PDT) Date: Wed, 29 Jul 2015 19:11:14 +0300 Message-ID: List-ID: <9front.9front.org> X-Glyph: ➈ X-Bullshit: mobile virtual method SSL software extension Subject: games/doom: fix config file never being loaded or saved From: qux To: 9front@9front.org Content-Type: text/plain; charset=UTF-8 games/doom: fix config file never being loaded or saved basedefault[], the default path to the config file, is never set and remains blank, unless -config %s is used (cd d_main.c). when games/doom attempts to open the file, it silently fails and no config file is ever read or written. this patch sets basedefault to a file in whatever directory a valid wad is found in I_IdentifyWAD(). if the config file is correctly saved/loaded, volume levels, screen size, key bindings, etc. are restored when games/doom is started again. this is cumbersome, because there there are four places where doom data files can be stored, rather than one. diff -r aa2b4dca05f1 sys/src/games/doom/i_system.c --- a/sys/src/games/doom/i_system.c Wed Jul 29 14:51:00 2015 +0200 +++ b/sys/src/games/doom/i_system.c Wed Jul 29 18:58:03 2015 +0300 @@ -121,11 +121,13 @@ char *home; snprint(path, sizeof path, wadname); + snprintf(basedefault, sizeof basedefault, "cfg"); if (I_FileExists (path)) return path; if(home = getenv("home")){ snprintf(path, sizeof path, "%s/lib/doom/%s", home, wadname); + snprintf(basedefault, sizeof basedefault, "%s/lib/doom/cfg", home); free(home); if (I_FileExists (path)) @@ -133,10 +135,12 @@ } snprintf(path, sizeof path, "/sys/lib/doom/%s", wadname); + snprintf(basedefault, sizeof basedefault, "/sys/lib/doom/cfg", home); if (I_FileExists (path)) return path; snprintf(path, sizeof path, "/sys/games/lib/doom/%s", wadname); + snprintf(basedefault, sizeof basedefault, "/sys/games/lib/doom/cfg", home); if (I_FileExists (path)) return path;