diff --git a/.gitignore b/.gitignore index 62437df..a40b45d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules config.override.json5 +libraryfolders.vdf diff --git a/README.md b/README.md index 4d3c8b4..4244c36 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Advisories are automatically detected events that the observer might want to switch to. To make switching to this event easier, the observer slot number is displayed next to an icon noting the type of advisory. -The observer should still make his own judgement of the situation. +The observer should still make his own judgment of the situation. All possible advisories are (with increasing priority): @@ -54,10 +54,10 @@ Running without window borders enables it to dedicate as much space as possible 2. Copy the `gamestate_integration_boltobserv.cfg` file from the .zip to your CSGO config folder (the same folder you'd put an `autoexec.cfg`). For most installations this should be found at `C:\Program Files\Steam\steamapps\common\Counter-Strike Global Offensive\csgo\cfg`. 3. You're done! Start the `Boltobserv.exe` file in the unzipped folder. Boltobserv should now automatically connect to CSGO when it's launched. -Please report any bugs or feature requests here on Github. +Please report any bugs or feature requests here on Github. -## License +## License -This project is licensed under GPL-3. In short, this means that all changes you make to this project need to be made open source (among other things). Commercial use is encouraged, as is distribution. +This project is licensed under GPL-3. In short, this means that all changes you make to this project need to be made open source (among other things). Commercial use is encouraged, as is distribution. The paragraph above is not legally binding. See the LICENSE file for the full license. diff --git a/config.json5 b/config.json5 index bb977db..6ce853b 100644 --- a/config.json5 +++ b/config.json5 @@ -7,7 +7,7 @@ // Sends information about the grenades thrown this round to a server // This information in only used to train a model to predict grenade // landings, no personal information is send or logged - "nadeCollection": false, + "nadeCollection": true, // Settings related to the Boltobserv window "window": { @@ -17,6 +17,9 @@ // Make the background of the window transparent "transparent": false, + // Will disable GPU rendering, helps capture the window in programs like OBS + "disableGpu": false, + // The default shape and position of the window "defaultSize": { // The height and width in pixels @@ -45,14 +48,17 @@ // Settings related to the CSGO game "game": { // Seconds of inactivity before considering a connection to the game client as lost - // Set to -1 to never timout + // Set to -1 to never timeout "connectionTimout": 30, // The port GSI will try to connect to - "networkPort": 36363 + "networkPort": 36363, + + // Tries to detect the CSGO game on the machine and prompts to install the CFG file if it hasn't already + "installCfg": true }, - // Settings for automatically zomming in on alive players on the map + // Settings for automatically zooming in on alive players on the map "autozoom": { // Enable or disable autozoom "enable": false, @@ -64,7 +70,7 @@ "padding": 0.3 }, - // Settings that should not be used in normal oparation, but help to find issues + // Settings that should not be used in normal operation, but help to find issues "debug": { // Draw red squares over bombsite locations "drawBombsites": false, diff --git a/detectcfg.js b/detectcfg.js new file mode 100644 index 0000000..75f4672 --- /dev/null +++ b/detectcfg.js @@ -0,0 +1,71 @@ +const fs = require("fs") +const path = require("path") + +const steamPaths = [ + // Default Windows install path + path.join("C:", "Program Files (x86)", "Steam", "steamapps"), + // For development + path.join(__dirname) +] + +module.exports = { + found: [], + search: () => { + let exp = /"\d"\s*"(.*)"/g + let commonPaths = [] + + for (let steamPath of steamPaths) { + let vdfPath = path.join(steamPath, "libraryfolders.vdf") + + commonPaths.push(path.join(steamPath, "common")) + + if (fs.existsSync(vdfPath)) { + let vdfContent = fs.readFileSync(vdfPath, "utf8") + + let appPath = exp.exec(vdfContent) + + while (appPath != null) { + commonPaths.push(path.join(appPath[1], "steamapps", "common")) + appPath = exp.exec(vdfContent) + } + } + } + + for (let commonPath of commonPaths) { + let gamePath = path.join(commonPath, "Counter-Strike Global Offensive") + + if (fs.existsSync(gamePath)) { + console.info("Found installation in", gamePath) + + let configPath = path.join(gamePath, "csgo", "cfg", "gamestate_integration_boltobserv.cfg") + + if (fs.existsSync(configPath)) { + let foundHeader = fs.readFileSync(configPath, "utf8").split("\n")[0] + let ownHeader = fs.readFileSync(path.join(__dirname, "gamestate_integration_boltobserv.cfg"), "utf8").split("\n")[0] + + if (foundHeader != ownHeader) { + module.exports.found.push({ + type: "update", + path: gamePath + }) + } + } + else { + module.exports.found.push({ + type: "install", + path: gamePath + }) + } + } + } + }, + + install: (path) => { + // Need to reimport path because of electron shenanigans + let template = require("path").join(__dirname, "gamestate_integration_boltobserv.cfg") + let dest = require("path").join(path, "csgo", "cfg", "gamestate_integration_boltobserv.cfg") + fs.copyFileSync(template, dest) + + console.info("Installed config file as", dest) + } +} diff --git a/gamestate_integration_boltobserv.cfg b/gamestate_integration_boltobserv.cfg index 36b6cef..8225b4f 100644 --- a/gamestate_integration_boltobserv.cfg +++ b/gamestate_integration_boltobserv.cfg @@ -1,4 +1,4 @@ -"Boltobserv GSI" +"Boltobserv integration v2 | https://github.com/boltgolt/boltobserv" { "uri" "http://localhost:36363" "timeout" "0.1" diff --git a/html/map.html b/html/map.html index 0c41324..7c51d54 100644 --- a/html/map.html +++ b/html/map.html @@ -17,6 +17,8 @@
+ +