Commit Graph

202 Commits

Author SHA1 Message Date
nathanel23
f65599e216 Fix for memory corruption/crash related to rhash
This patch fixes issues with some calls to the rhash C library that
cause subtle memory corruptions. There are two main issues that this
patch addresses:

1) The library init function is called multiple times in various places
within in the Util class. This is not necessary and may cause issues
if the initialization is repeated simultaneously in multiple threads.
Therefore the call was moved to the beginning of the main() function.

2) There is not enough space in the output buffers to store the
terminating NUL character of the hex-formatted hashes. The print
function from the rhash library writes a regular C string to
the output buffer and expects enough space to include the end
marker.

Depending on the memory layout generated by the compiler, this results
in one byte of the stack to be overwritten, which might lead to random
issues that are hard to find. On AArch64 (ARM) with GCC 6.3 the call to
the rhash_print() function happens to destroy the lower byte of the
frame pointer and causes a crash due to an invalid free() operation some
time after the Util::createXML function returned.
2019-01-06 01:06:23 +01:00
Sude
df628b2a59 Add option to include hidden products
Adds option --include-hidden-products that allows user to list and download products that have been set hidden in account page.
2018-12-20 13:10:27 +02:00
Sude
ab84d6f827 Galaxy: Add option to set CDN priority
--galaxy-cdn-priority option allows to set priorities for content delivery networks
2018-09-12 20:07:59 +03:00
Sude
1b3b04b28c Galaxy: Add option to set subdirectory for installation
New option --subdir-galaxy-install allows user to set installation subdirectory when using --galaxy-install
2018-09-12 15:18:54 +03:00
Sude
05e9409d52 Add separate option to set libcurl to verbose mode
New --curl-verbose option is used to set libcurl to verbose mode.
Old --verbose option is still used to print more information but no longer sets libcurl to verbose mode.
2018-09-05 17:51:03 +03:00
Sude
35b178e674 Galaxy: Add support for downloading dependencies
Adds support for downloading dependencies for a game
Added --galaxy-no-dependencies option to disable downloading dependencies during --galaxy-install
2018-09-05 17:41:43 +03:00
Sude
cae5f80698 Allow saving empty option values to config
Fixes issues caused by boost program options overriding desired value with default value because it wasn't found in config file.

For example using --subdir-extras "" --save-config would erase subdir-extras from config file.
Trying to download something would then cause the downloader to use default value for subdir-extras because it wasn't found in config.
2018-08-23 21:30:24 +03:00
Sude
8e9c094929 Replace --update-check option and remove --game aliases
Replace --update-check option with --updated and --notifications options
--updated restricts downloader to operate only on games that have update flag set in account page
--notifications shows the number of new forum replies, updates games, unread chat messages and pending friend requests
--clear-update-flags clears update notification flags for all games

Remove aliases for --game option
"free" could no longer be used as originally intended and "all" was unnecessary because leaving regex empty has the same effect
2018-07-21 23:59:08 +03:00
Sude
9dc5d4124c Add OS and arch to default user agent 2018-07-01 22:51:32 +03:00
Sude
04370b8b53 Better help text for galaxy-install and galaxy-show-builds 2018-05-14 11:38:56 +03:00
Sude
c6e5214910 Remove numeric option values from help text 2018-05-14 11:25:52 +03:00
Sude
ef1a344610 Remove cover download support 2018-05-14 11:12:10 +03:00
Sude
90dcaf0106 Add options to set low speed timeout values for libcurl 2017-11-08 15:20:03 +02:00
Sude
8a71c63b20 Add option to set interval for progress bar update 2017-08-18 09:33:10 +03:00
Sude
4f8843312c Expose galaxy options as experimental options in help text 2017-08-18 09:19:48 +03:00
Sude
35192fd725 Add option to set user agent 2017-08-01 23:59:11 +03:00
Sude
3fb05682c6 Fix help text for --subdir-installers 2017-06-07 11:53:10 +03:00
Sude
29e5febab0 Galaxy: Support selecting platform architecture
Add option --galaxy-arch to select architecture.
Supports selecting platform architecture when "osBitness" is set for depot.
If "osBitness" is not set in API response then assume that we want to download the files from depot.
2017-05-23 16:44:27 +03:00
Sude
d4a6791e65 Galaxy: Add option to select language 2017-03-06 07:22:34 +02:00
Sude
f5af312fd4 Add option to set login info on command line or read it from file
Add --login-email and --login-password to set login info on command line

Read login info from $XDG_CONFIG_HOME/lgogdownloader/login.txt if the file exists
login.txt must contain email on the first line and password on the second line
2017-03-06 05:46:48 +02:00
Sude
f9981c1be0 Galaxy: Add option to select platform 2017-03-05 22:47:44 +02:00
Sude
f2e8dde934 Some initial Galaxy code
Add some code for initial Galaxy support.
Rewrite and move code around in preparation for GOG Galaxy API support.
2017-02-17 11:14:28 +02:00
Sude
dea82b7991 Some code restructuring
- Move some code from Downloader::init() to constructor
- Add function API::isLoggedIn()
- Add function Downloader::isLoggedIn()
- Don't call Downloader::getGameList() from Downloader::init(). Call it from other functions if/when needed

Also fix some login issues
2016-12-17 21:01:44 +02:00
Sude
34e3af3438 Ignore DLC count information for specific games
Ignore DLC count information for specific games by using a list of games that we know have DLC.
GOG reports wrong DLC count information for many games. By using a list of games that we know have DLC we can ignore DLC count info that GOG provides for those games.
User can use local list ($XDG_CONFIG_HOME/lgogdownloader/game_has_dlc.txt) or use remote list by using the new "--dlc-list" option.
The list uses same format as blacklist.
2016-11-05 14:51:52 +02:00
Sude
fb565f4493 Add "Message" class
Changed message queue to use the new "Message" class.
Simplifies status message printing by having the message class take care of formatting and keeping track of the message type.

Status messages are now timestamped and colored based on message type
2016-11-03 21:25:33 +02:00
Sude
0dfa610c28 Merge branch 'exit-status' of https://github.com/chewi/lgogdownloader 2016-11-03 20:54:04 +02:00
James Le Cuirot
1388c00a4e
Exit with non-zero status when --list or --list-details fails 2016-09-23 22:20:37 +01:00
James Le Cuirot
d8b8d6da96
Exit with non-zero status when at least one --download-file fails 2016-09-23 22:20:08 +01:00
James Le Cuirot
e36552c6ed
Add --respect-umask option to prevent adjusting permissions
I would like to use LGOGDownloader in conjunction with Gentoo's
package manager, which may execute it as root, portage, or some other
user in the portage group. A shared configuration under /etc will be
used to avoid sandboxing issues. This will not be world readable.
2016-09-21 23:49:32 +01:00
Sude
0b455ddedc Add option to set CA certificate path
Adds options to set path to CA certificate bundle in PEM format.
CURL_CA_BUNDLE environment variable is used if it is set and CA certificate path is not set with --cacert option.
2016-08-30 19:34:47 +03:00
Sude
442fad04db Add support for parallel downloads
New option "--threads" can be used to set how many parallel downloads to run. The default is 4 threads.

Changes to behavior:
- Serials and changelogs are saved and covers downloaded for all games that match the "--game" filter before any other files are downloaded.
- Automatic XML creation is run after all files are downloaded. Previously xml data was automatically created right after download finished.
- The "--limit-rate" option sets rate limit for thread not global rate limit.
2016-05-20 20:33:07 +03:00
Sude
a0650129f7 Don't print help text after login 2016-03-12 09:37:30 +02:00
Sude
987e053ad4 Add option to save changelogs 2016-03-06 15:45:22 +02:00
Thomas J. Moore
9520f3f3b7 Improvements to orphan detection:
- blacklist applies to installed files only; use ignorelist for orphans
  - blacklisted but present items are orphans, as they should be
  - use exact matching for file paths: files in wrong location are orphans
2016-02-20 14:59:52 -06:00
Thomas J. Moore
c0735d5993 Use cerr for password prompts, error messages, rolling status
messages, and other stuff that shouldn't clutter saved stdout.
Probably needs more work.
2016-02-20 14:56:44 -06:00
Sude
0de2a9f64b Add support for priority in game specific language and platform options 2016-02-20 15:34:51 +02:00
Sude
fc88679b12 Add option to set automatic XML creation in config file 2016-02-04 11:51:11 +02:00
Sandy Carter
a5cc950192 CMake: Convert Makefile build to CMake
Find libraries using cmake/Find*.cmake scripts
Replace Version String with CMake implementation based on CMake Version and
git ref-parse.
Compile manpages in man/CMakeLists.txt to build:
    cmake .
    make manpage
Set debug and release versions with
    cmake -DCMAKE_BUILD_TYPE=Debug
and
    cmake -DCMAKE_BUILD_TYPE=Release
Build and install process can be:
    cmake -DCMAKE_BUILD_TYPE=Release .
    make
    make install
More build options can be found with
    cmake .
    make help
Codeblocks project can be generated using
    cmake -G "CodeBlocks - Unix Makefiles" .
2016-01-03 16:50:29 -05:00
Sude
8780b9c53c Possible fix for crash after login 2015-11-18 15:21:22 +02:00
Sude
97d01b2de6 Version 2.26 2015-10-14 15:24:02 +03:00
Sude
3465384e0b Use include/exclude options to select what to download/list/repair
The default is "--include all --exclude covers"
2015-10-07 11:52:04 +03:00
Sude
211aa3a3e6 Combine priority handling with --platform and --language options
Use "+" as separator to combine values and "," to set priority
2015-10-03 19:09:50 +03:00
Sude
ba27e4fbcc Add version string and number to cached game details 2015-10-03 19:00:51 +03:00
Sude
d9587e4544 Version 2.25 2015-09-05 11:15:15 +03:00
Sude
0a7e3a217e Update help text of --download-file option 2015-09-05 11:11:12 +03:00
Sude
63145eef0d Simplify string parsing for downloading with file ids 2015-09-03 13:18:30 +03:00
Sude
b4fd9fcf5c Use regular expressions for getting language and platform option values
Selecting languages with --language and --language-priority
- Whatever code GOG happens to use in their API (mostly ISO 639-1)
- ISO 639-1
- ISO 639-2/T
- ISO 639-2/B
- English name

Selecting platforms with --platform and --platform-priority
- Windows: "w, win, windows"
- Linux: "l, lin, linux"
- Mac: "m, mac, osx"
2015-09-02 11:16:00 +03:00
Sude
2206e988a6 Initial support for using platform/language strings to set options 2015-09-01 14:45:34 +03:00
Sude
9b560d786e Some minor code cleanup 2015-09-01 13:59:54 +03:00
Sude
887ac52563 Some improvements to priority handling
Fixes issues with some strings that caused issues previously
For example: 4,,1 is now handled correctly
2015-08-29 16:18:20 +03:00
Sude
a8e09a7f48 Use same structure for language and platform structs 2015-08-29 15:03:20 +03:00
Sude
06d211f534 Simplify and remove duplicate code for getting config directory paths 2015-08-29 14:26:36 +03:00
Sude
f992466ddf Fix priority handling with duplicate values
Having duplicate values in priority string caused platform/language to be set to wrong value
For example --platform 1 --platform-priority 4,1,1 caused platform to be set to 6 instead of 5
2015-08-29 14:22:18 +03:00
Sude
f9c15dfaca Make automatic xml creation default for --create-xml 2015-08-29 14:18:10 +03:00
Sandy Carter
9c2f35bb27 Only return if --save-config is specified
Continue running commands if login was forced due to missing configuration
Allow downloading of files even if config is missing with only one prompt
for username and password
2015-08-17 19:27:23 -04:00
Sandy Carter
a066e99bad If no login method is defined default to api 2015-08-17 19:20:57 -04:00
Sandy Carter
5c9488fc13 Prevent the use of --output-file when downloading multiple files 2015-08-15 07:57:43 +03:00
Sude
b6d07f5343 Merge branch 'outname' of https://github.com/bwrsandman/lgogdownloader 2015-08-15 07:56:53 +03:00
Sandy Carter
bc92655702 Add output filename option
Add -o option to specify path and downloaded file name when using
--download-file
Overrides --directory
2015-08-14 23:15:15 -04:00
Sandy Carter
b19314af78 Enable multiple file download with protocol address
Implement download of gog addresses containing commas of the form:
    gogdownloader://GAME_NAME_1/FILE_ID1,GAME_NAME_2/FILE_ID2,...
2015-08-14 21:48:58 -04:00
Sandy Carter
04251776d3 Interpret protocol-prefixed argument as download argument 2015-08-14 21:48:58 -04:00
Sandy Carter
1eb2e8deaa Strip out protocol substring for file download 2015-08-14 21:48:55 -04:00
Sude
6132b7a96c Add .sh to orphan check regex 2015-08-14 20:36:23 +03:00
Sude
b65084dd65 Remove --no-deb and --no-targz options
GOG no longer provides deb and tarball archives
2015-08-12 17:15:14 +03:00
Sude
f51cca5dff Add options to login separately to website and API 2015-08-12 16:42:54 +03:00
Sude
4c6ac86619 Version 2.24 2015-07-11 14:51:11 +03:00
Sude
64690d0368 Add status code for file size mismatch 2015-07-02 03:01:21 +03:00
Sude
0f2268cb67 Use ".*" as default for --ignore-dlc-count 2015-06-21 17:25:45 +03:00
Sude
9c80ed1d39 Implicitly set the default value for ignore-dlc-count option 2015-06-21 05:57:30 +03:00
Sude
834e6baa7a Add options to ignore DLC count information
Ignoring DLC count information helps in situations where the account page doesn't provide accurate information about DLCs.
--ignore-dlc-count sets regular expression filter for games to ignore DLC count information.
Game specific option "ignore-dlc-count" can be used to ignore DLC count for specific game.
2015-06-01 10:45:30 +03:00
Sude
8caaf30f16 Version 2.23 2015-05-17 19:04:59 +03:00
Sude
61cc4187e6 Wishlist option should not be saved to config file 2015-05-17 18:47:04 +03:00
Sude
6a8d21b5f7 Version 2.22 2015-05-16 23:52:52 +03:00
Sude
29e6b6290c Add option to show wishlist 2015-05-13 17:13:30 +03:00
Sude
d97849818e Add option to download files using file id 2015-04-11 16:42:10 +03:00
Sude
84c3385e87 Version 2.21 2015-04-07 13:45:56 +03:00
Sude
3834c1e612 Add option to skip fast platform detection
Useful in case platform identifier is missing for some games in the game shelf.
Using --platform with --list doesn't work when using --no-platform-detection
2015-03-28 12:52:41 +02:00
Sude
216cfaedfe Add support for saving serial numbers 2015-03-19 09:50:50 +02:00
Sude
61e0c31775 Version 2.20 2014-12-06 20:10:13 +02:00
Sude
6751205ff3 Fix regex alias "all" for cached details 2014-11-17 16:28:43 +02:00
Sude
cb2395b0ba Make config and cookie files only readable/writable by current user 2014-10-28 21:03:02 +02:00
Gael Le Mignot
1204ea247e Preparation work on priority mode: config file parsing, documentation. 2014-10-25 17:57:04 +02:00
Sude
ffaed76c34 Version 2.19 2014-10-21 13:36:20 +03:00
Sude
eef4712b6e Make sure that cache directory exists 2014-10-16 11:31:08 +03:00
Sude
9235ee8b4a Add support for caching game details
Helps with large libraries when running the downloader multiple times.
Getting game details for many games takes a long time. Caching the game details makes the process much faster for subsequent runs.

Game details are cached to "$XDG_CACHE_HOME/lgogdownloader/gamedetails.json"
--update-cache creates and updates the cache.
--use-cache enables loading game details from cache.
--cache-valid specifies how long cached game details are considered valid
2014-10-16 11:05:57 +03:00
Sude
b954df2bbc Version 2.18 2014-09-21 14:37:29 +03:00
Sude
5f7d04334f Use current directory if directory wasn't specified 2014-09-19 23:07:16 +03:00
Sude
5635909e20 Add support for setting subdirectories
Allows user to specify subdirectories for games, installers, extras, patches, language packs and dlc
2014-09-19 22:46:03 +03:00
Sude
4d404fc7df Rename old file instead of deleting it during --repair --download 2014-09-17 13:05:04 +03:00
Sude
7a15a93676 Change --report option to allow setting the filename of report 2014-09-17 12:41:01 +03:00
Stephen Kitt
a6eaeb1a5b Avoid touching $HOME when displaying help or version
Currently any execution of lgogdownloader touches $HOME, even if the
user only requested help or the version number. This fixes main() to
handle --help and --version before doing anything to the filesystem.

This also helps some build environments where $HOME is undefined
(e.g. the Debian build platform).

Signed-off-by: Stephen Kitt <steve@sk2.org>
2014-09-11 23:38:23 +02:00
Sude
369e8bb10b Add --no-cover option back
Used to override --cover option.
2014-09-05 20:25:40 +03:00
Sude
83ef937089 Allow unrecognized options in config file 2014-09-05 14:02:08 +03:00
Sude
10233291eb Version 2.17 2014-08-30 11:13:53 +03:00
Sude
cd2d1f22f8 Added --cover-list option to set url for cover list 2014-08-28 16:00:24 +03:00
Sude
6fa03e1219 Version 2.16 2014-08-21 11:49:11 +03:00
Sude
5dd8332b9e Add --no-deb and --no-targz command line options 2014-08-18 07:59:04 +03:00
Sude
11be8a79cd Add .pkg to to orphan check regex
.pkg is used for Mac patches
2014-08-18 07:49:22 +03:00
Sude
214a843e2c Change --no-cover to --cover
Don't download covers by default
2014-08-15 16:51:48 +03:00
Sude
eda6c67854 Add .deb and .tar.gz to orphan check regex 2014-07-31 15:12:00 +03:00