Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Game report: add precise version and name for systems. #30729

Merged
merged 12 commits into from
May 23, 2019
Merged

Game report: add precise version and name for systems. #30729

merged 12 commits into from
May 23, 2019

Conversation

neitsa
Copy link
Contributor

@neitsa neitsa commented May 21, 2019

Summary

SUMMARY: Features "Add game report precise system versions."

Purpose of change

  • Add Windows precise version (e.g. Windows 10 1809).
  • Add Linux system name and version (e.g Ubuntu 18.04).
  • Add MacOs version.
  • Add BSD version.
  • Android version.

Describe the solution

  • Windows: Use the registry and (if it fails) the native RtlGetVersion API.

    • All other version-related APIs "lie" about the underlying system if the application is not Manifested. e.g. An application running on Windows 10 without a manifest may report Windows 8.1 or Windows 7...
    • This behavior is documented in verifyversioninfoa for example.
  • Linux: rely on LSB and shell-out to call lsb_release -a. This is the more "global" solution which encompasses most of the distributions without having to resort on a giant switch and try /error depending on the underlying system.

  • MacOs: Use sw_vers through the shell as suggested by ifreund.

  • BSD: Use uname -a which gives more information than on linux.

  • Android: Use __system_property_get as suggested here on SO. This doesn't require JNI!

Describe alternatives you've considered

  • N/A.

Additional context

Sample output examples (tested):

  • Windows: Windows 10.0 1809; Windows 7.0
  • Linux: Distributor ID: Ubuntu; Description: Ubuntu 18.10; Release: 18.10; Codename: cosmic;
  • MacOS: Name: Mac OS X; Version: 10.14.5; Build: 18F132; (thanks to ifreund!)

Expected output examples (untested):

  • Android: Manufacturer: samsung; Model: SAMSUNG-SM-G930A; Release: 6.0.1; Incremental: G930AUCS4APK1
    • Example for a Samsung Galaxy S7:
      • SAMSUNG-SM-G930A is the internal name for the Samsung Galaxy S7.
      • 6.0.1 is the Android version.
      • G930AUCS4APK1 is the samsung official build number for this Android.
  • BSD: FreeBSD 11.2-RELEASE-p4 amd64

@ifreund
Copy link
Contributor

ifreund commented May 21, 2019

I believe sw_vers -productVersion is what you'd want for macOS
See: https://www.manpagez.com/man/1/sw_vers/

Edit: it seems that sw_vers may just check /System/Library/CoreServices/SystemVersion.plist which contains all the version info. It may be better to use that.
Mine is:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>ProductBuildVersion</key>
	<string>18F132</string>
	<key>ProductCopyright</key>
	<string>1983-2019 Apple Inc.</string>
	<key>ProductName</key>
	<string>Mac OS X</string>
	<key>ProductUserVisibleVersion</key>
	<string>10.14.5</string>
	<key>ProductVersion</key>
	<string>10.14.5</string>
	<key>iOSSupportVersion</key>
	<string>12.3</string>
</dict>
</plist>

@neitsa
Copy link
Contributor Author

neitsa commented May 22, 2019

Oh, that's really neat, thank you very much @ifreund!

@ifreund ifreund added <Enhancement / Feature> New features, or enhancements on existing [C++] Changes (can be) made in C++. Previously named `Code` Other Things that can't be classified anywhere else labels May 22, 2019
@neitsa neitsa marked this pull request as ready for review May 22, 2019 13:31
Copy link
Contributor

@ifreund ifreund left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me on mac.

The debug log generated was:

-----------------------------------------
18:31:32.182 : Starting log.
18:31:32.182 INFO : Cataclysm DDA version 0.D-3354-gf902ee09b5
18:31:32.184 INFO : Number of render drivers on your system: 4
18:31:32.184 INFO : Render driver: 0/opengl
18:31:32.184 INFO : Render driver: 1/opengles2
18:31:32.184 INFO : Render driver: 2/metal
18:31:32.184 INFO : Render driver: 3/software
18:31:33.382 INFO : SDL version used during compile is 2.0.9
18:31:33.382 INFO : SDL version used during linking and in runtime is 2.0.9
18:31:33.518 INFO : Active renderer: 2/metal
18:31:33.531 INFO : USE_COLOR_MODULATED_TEXTURES is set to 0
18:31:33.563 WARNING : opendir [./mods/] failed with "No such file or directory".
18:32:03.214 WARNING : opendir [./save/Cecilia/mods] failed with "No such file or directory".
18:32:04.383 INFO : Loaded tileset: ASCIITiles
18:32:31.529 :  GAME REPORT: 
- OS: MacOs [64-bit]
    - OS Version: Name: Mac OS X; Version: 10.14.5; Build: 18F132; "n- Game Version: 0.D-3354-gf902ee09b5
- Graphics Version: Tiles
- Mods loaded: [
    Dark Days Ahead [dda],
    Disable NPC Needs [no_npc_food]
]

18:35:01.529 : Log shutdown.
-----------------------------------------

@neitsa
Copy link
Contributor Author

neitsa commented May 22, 2019

Thank you very much @ifreund for testing the output! Thanks to you I just saw that there was a typo in the output...

"    - OS Version: " << os_version << "\"n" << // misplaced "

I'm pushing a fix.

@ifreund
Copy link
Contributor

ifreund commented May 22, 2019

Jenkins rebuild

@ZhilkinSerg ZhilkinSerg merged commit 63b649f into CleverRaven:master May 23, 2019
Mooses2k added a commit to Mooses2k/Cataclysm-DDA that referenced this pull request May 23, 2019
mlangsdorf suggestion on saving ally_rule

remove redunancy

comma

mlangsdorf suggested scope fix

rules.

This makes it work, but text is backwards

fixes so lines up with text in dialogue
CHANGES THE DEFAULT FOLLOW DISTANCE TO 2

Rock as a spare part

Switch build configurations away from trusty

For clang-4 we use the Trusty source on Xenial.

For clang-5 that trick doesn't work, so we retain the Trusty host.

Fix coverage CXXFLAGS code

This was setting CXXFLAGS and LDFLAGS, when it should have been
appending to them.  Without this, Travis builds will fail because they
can't disable warnings on old compilers.

Improve .travis.yml comments

Try trimming down build somewhat

Add clang-7, clang-8 Travis builds

Disable clang-6 and -7 builds on PRs

Don't install unnecessary 32-bit libraries

These two Travis builds were installing 32-bit libraries, for which
there should be no need.

add fire barrels

Update data/json/recipes/recipe_others.json

update per review

Co-Authored-By: Alexey Mostovoy <[email protected]>

Update data/json/recipes/recipe_others.json

update per review

Co-Authored-By: Alexey Mostovoy <[email protected]>

Update furniture.json

update per review

Update furniture.json

Add description to furniture.json

Update data/json/furniture.json

Co-Authored-By: matskuman5 <[email protected]>

Update data/json/items/tool/deployable.json

Co-Authored-By: matskuman5 <[email protected]>

Update data/json/furniture.json

Co-Authored-By: matskuman5 <[email protected]>

Update data/json/items/tool/deployable.json

Co-Authored-By: matskuman5 <[email protected]>

avatar::memorial

moved memorial out of player into the new avatar class

added NPC text

Fix missing declarations (CleverRaven#30739)

* Fix missing declarations
Mark functions with no prior declarations as static, and remove the
unused ones.
* Move debug_is_safe_string definition
Put it inside !WIN32 since it's only used there.

fixed typo in NR-031 description

typo!

acorn_roasted: remove duplicate entry for itype acorn_roasted

There are two acorn_roasted entries in this file. The one removed is
defined prior to the itype it copies from (acorns). The remaining entry
is immediately following the definition of acorns, and can be loaded
without being deferred.

Change to variable name and logic requested by mlangsdorf

Avoid undefined shift

Avoid uninitialized value in jmapgen_int

NOLINT undefined shifts in legacy hash code

Enable clang-analyzer-core.UndefinedBinaryOperatorResult

Have fixed all warnings for this check.

Remove legacy hash code

This was only present in the tests, contained undefined behaviour, and
was obsolete.

Add a --user-dir option to the tests

This gives control over where the tests write files, which allows
parallel test runs to be performed without stepping on each other's
toes.

Use separate user_dir for modded tests

Now the tests can run in parallel, have one of them write to a different
location to avoid failures due to filesystem race conditions.

Changed weight and volume values to be more realistic.

Fixed silly JSON error.

Linted JSON.

Added empty newline at the end of the file to satisfy the JSON linting gods.

Move hydroponics mod folders out of a subfolder

Replaced battery spawn with full pocket batteries

Moved Brawling martial art autolearn code to json

Logic that determines if a martial arts style is learned each turn is controlled by json instead of hardcoded.

Astyle typo fixes

Update MARTIALART_JSON.md

Saving some future person a bunch of time

Add clean water to makeshift steam engine recipe

Allows the player to use clean water to make makeshift steam engines.

Fix copy-from for overmap specials

Restore minimap enemy blink/fade functionality (CleverRaven#30745)

* start conditional panel update infrastructure

* Revert "Remove unnecessary `draw_panels()` calls"

This reverts commit 2db3b84.

* Revert "Only draw panels on first entry into game::get_player_input()"

This reverts commit d629d93.

* commit include file change

* preserve panel spacing (so minimap draws in right location)

* comments are fun.

* adjust draw_panels invocations to force redraw when appropriate

* cleanup of things that shouldn't have been reverted

Fixes cell phone and talking doll weirdness (CleverRaven#30742)

* Added charged phone group.

* Removed initial_charges from cell phone

* Began the work

Added a proper item template to everyone who needs a charged cell phone starting out. This is gonna suck...

* First pass on professions.json

* Fixed professions.json

* Fixed the mods too!

* Removed initial_charges from creepy_doll and talking_doll

* Update data/json/professions.json

Co-Authored-By: ZhilkinSerg <[email protected]>

* Update data/json/professions.json

Co-Authored-By: ZhilkinSerg <[email protected]>

* Modified home_mechanic to have a charged phone

They didn't really need it, but I did it for consistency.

Game report: add precise version and name for systems. (CleverRaven#30729)

* Add precise versions for Windows systems.

* Add Android system version retrieval.

* Simplify formatting for Windows version.

* Add Linux system version.

* make operating_system_version() return '<unknown>' if the version can't be determined.

- Invert condition on Linux version function;

* Simplify Android version retrieval.

* Extract shell execution function.

- will be reused by Linux, Mac and BSD.

* Add MacOS system version.

* Sort methods alphabetically.

* Add BSD version retrieval.

* Fix structure init. Fix error in macos function.

* Fix typo in output...

Robot salvage system (CleverRaven#30456)

* nervous sytem modules
* motor system
* structural system
* tank tread
* ai core
* more AI cores
* Uncraft Robots
* gun fix
* uncraft nursebot
* uncraft turret
* inactive turrets recipe
* manhack recipe
* uncraft hazmatbot
* Add schematics for bots
* schematics item group
* item_groups fro schematics
* recipe for every bot
* uncraft modules
* add self_monitoring_module to nurse and cleaner bots
* Damage overflow from a robot is transfered to its corpse
* sane crafting time
* flavor on robot death
* can't repair broken robot items
* electronics is used skill, mechanics is required

mall miscellanious files

pallet, overmap_terrain, item_groups, multitile_city_buildings entries

2nd story, roof enhancements

Adds 2nd story and more work on the roof

move item_group

per feedback

Add AT4 (CleverRaven#30734)

* Added AT4 to guns_launcher_rocket itemgroup
* Add AT4

disp_name and skin_name

stomach and guts

Fix some typos in uninstall bionic (CleverRaven#30763)

* fix uninstall typos
@neitsa neitsa deleted the feature/system_versions branch May 23, 2019 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` <Enhancement / Feature> New features, or enhancements on existing Other Things that can't be classified anywhere else
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants