diff --git a/.eslintrc.yml b/.eslintrc.yml new file mode 100644 index 00000000..bc4bf977 --- /dev/null +++ b/.eslintrc.yml @@ -0,0 +1,31 @@ +env: + browser: true + es2021: true + node: true +extends: + - 'eslint:recommended' + - 'plugin:react/recommended' + - 'plugin:@typescript-eslint/recommended' +parser: '@typescript-eslint/parser' +parserOptions: + ecmaFeatures: + jsx: true + ecmaVersion: 12 + sourceType: module +plugins: + - react + - '@typescript-eslint' +rules: + indent: + - error + - tab + linebreak-style: + - error + - unix + quotes: + - error + - single + semi: + - error + - always + '@typescript-eslint/ban-ts-comment': off diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000..7948cecf --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,4 @@ +# These are supported funding model platforms + +patreon: ottomated +custom: https://www.paypal.me/ottomated diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..155cf322 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,43 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '[BUG REPORT]' +labels: 'bug' +assignees: '' +--- +# You MUST use this template or your issue will be deleted. + +# Pre-Flight Checklist +Please use this checklist to avoid spamming: + +1. [ ] I am not asking a question => use the [Discord](https://discord.gg/9mwuVNA) if you are +2. [ ] I am using the Steam version of Among Us +3. [ ] I have tried to use an [alternative voice server](https://status.crewl.ink/) +4. [ ] I have checked everyone in my lobby is on the same CrewLink server +5. [ ] I have used `Ctrl+R` on the CrewLink app when I can't hear some people (this is a known issue) +6. [ ] I have checked that the CrewLink server I'm using is up to date +7. [ ] I have a screenshot of any errors +8. [ ] I have checked that someone else has not reported this using the [search bar](https://github.com/ottomated/CrewLink/issues?q=is%3Aissue) + +**Describe the bug** + + +**To Reproduce** +Steps to reproduce the behaviour: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behaviour** + + +**Screenshots** + + +**Desktop (please complete the following information):** + - OS: [e.g. Windows 10] + - Version: [e.g. 1.1.5] + +**Additional context** + diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000..a0440d3b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,11 @@ +blank_issues_enabled: false +contact_links: + - name: YOU MUST USE ONE OF THE ABOVE TEMPLATES OR YOUR ISSUE WILL BE DELETED! + url: https://github.com/ottomated/CrewLink/issues/new/choose + about: This is to prevent duplicate issues and spam. + - name: I need help + url: https://discord.gg/9mwuVNA + about: Please ask and answer questions here. + - name: Security issue + url: https://discord.gg/9mwuVNA + about: Please report security vulnerabilities directly to Ottomated#9999. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..fef99b67 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,30 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '[FEATURE]' +labels: 'enhancement' +assignees: '' +--- + +# Pre-Flight Checklist +Please use this checklist to avoid spamming: + +1. [ ] I am not asking a question => use the [Discord](https://discord.gg/9mwuVNA) if you are +2. [ ] I have checked that someone else has not suggested this using the [search bar](https://github.com/ottomated/CrewLink/issues?q=is%3Aissue) +3. [ ] My feature request is not one of the **commonly suggested features**: +- Adjustable voice radius +- Mobile support +- Linux / MacOS support +- Itch.io support + +**Is your feature request related to a problem? Please describe.** + + +**Describe the solution you'd like** + + +**Describe alternatives you've considered** + + +**Additional context** + diff --git a/README.md b/README.md index a8f55c3c..c302baa0 100644 --- a/README.md +++ b/README.md @@ -17,10 +17,13 @@ ยท INSTALLATION INSTRUCTIONS
++ DONATE TO THE PROJECT + (all donations will be used for server costs or paying for college) +
- ## Table of Contents diff --git a/TODO.md b/TODO.md new file mode 100644 index 00000000..040c986c --- /dev/null +++ b/TODO.md @@ -0,0 +1,40 @@ +# TODO before CrewLink 2.0.0 + +## Server + +- [ ] Migrate from socket.io to a raw websocket connection. Ensure it auto-reconnects. +- [ ] Request offsets over the websocket connection, to keep the number of open sockets down. +- [ ] Move the default server to a better host. +- [ ] Rewrite all error messages to be even more human-readable. +- [ ] Integrate an official server list into the client. +- [ ] Detect the reason *why* the server can't provide offsets: i.e. Among Us just updated, it's an old version of Among Us, the server hasn't updated, etc. + +### Stretch + +- [ ] Distribute the server load, with a centralized matchmaking database. +- [ ] Re-write the server in Rust. + +## Voice / WebRTC + +- [ ] Add a microphone boost slider. +- [ ] Add a speaker adjustment slider. +- [ ] Add individual adjustment sliders to each of the players. +- [ ] Handle all RTC errors to make it unnecessary to ever re-open an RTC connection. +- [ ] Detect reason for RTC failure: NAT type, etc? +- [ ] Re-enable all `navigator.getUserMedia` functions that can be re-enabled with autoGainControl kicking in. +- [ ] Move all player-to-player communication logic to RTC data channels, versus sending them over the websocket. + +### Stretch + +- [ ] Implement an optional TURN server. + +## Game Reader + +- [ ] Fix unicode characters in player names +- [ ] Indicate to the user when it can't read memory properly. Example: screen displays `MENU` while in lobby due to some misplaced offset. +- [ ] Don't use the Unity Analytics file to read the game version. Use either a hash of the GameAssembly dll, or DMA it from the process. + +### Stretch + +- [ ] Move away from DMA and towards a different method. Probably network packet sniffing? Maybe DLL injection? +- [ ] Add itch.io and Linux/Mac support. This will be easiest with packet sniffing. diff --git a/package.json b/package.json index 99b1197e..0a1b8026 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "crewlink", - "version": "1.1.2", + "version": "1.1.6", "license": "GPL-3.0-or-later", "description": "Free, open, Among Us proximity voice chat", "repository": { @@ -18,22 +18,23 @@ }, "scripts": { "postinstall": "electron-builder install-app-deps", + "lint": "eslint src", "dev": "electron-webpack dev", "compile": "electron-webpack", "dist": "yarn compile && electron-builder --win --x64", "publish": "yarn compile && electron-builder --win --x64 --publish always" }, "dependencies": { + "ajv": "^6.12.6", "analyser-frequency-average": "^1.0.0", - "audio-activity": "^1.0.0", "axios": "^0.21.0", - "color": "^3.1.3", "cross-spawn": "^7.0.3", "electron-store": "^6.0.1", "electron-updater": "^4.3.5", + "electron-window-state": "^5.0.3", "iohook": "git://github.com/ykhwong/iohook", "jsondiffpatch": "^0.4.1", - "memoryjs": "https://github.com/Rob--/memoryjs", + "memoryjs": "git://github.com/Rob--/memoryjs", "react": "^17.0.1", "react-dom": "^17.0.1", "react-spinners-kit": "^1.9.1", @@ -56,10 +57,14 @@ "@types/simple-peer": "^9.6.1", "@types/socket.io-client": "^1.4.34", "@types/webpack-env": "^1.15.3", + "@typescript-eslint/eslint-plugin": "^4.9.1", + "@typescript-eslint/parser": "^4.9.1", "electron": "9.3.3", "electron-builder": "^22.9.1", "electron-webpack": "^2.8.2", "electron-webpack-ts": "^4.0.1", + "eslint": "^7.15.0", + "eslint-plugin-react": "^7.21.5", "ts-interface-builder": "^0.2.2", "typescript": "^4.0.3", "webpack": "~4.42.1" diff --git a/src/common/AmongUsState.ts b/src/common/AmongUsState.ts new file mode 100644 index 00000000..17d7301d --- /dev/null +++ b/src/common/AmongUsState.ts @@ -0,0 +1,29 @@ + +export interface AmongUsState { + gameState: GameState; + oldGameState: GameState; + lobbyCode: string; + players: Player[]; +} +export interface Player { + ptr: number; + id: number; + name: string; + colorId: number; + hatId: number; + petId: number; + skinId: number; + disconnected: boolean; + isImpostor: boolean; + isDead: boolean; + taskPtr: number; + objectPtr: number; + isLocal: boolean; + + x: number; + y: number; + inVent: boolean; +} +export enum GameState { + LOBBY, TASKS, DISCUSSION, MENU, UNKNOWN +} diff --git a/src/common/ISettings.d.ts b/src/common/ISettings.d.ts new file mode 100644 index 00000000..e54031a3 --- /dev/null +++ b/src/common/ISettings.d.ts @@ -0,0 +1,16 @@ + +export interface ISettings { + alwaysOnTop: boolean; + microphone: string; + speaker: string; + pushToTalk: boolean; + serverURL: string; + pushToTalkShortcut: string; + deafenShortcut: string; + offsets: { + version: string; + data: string; + }, + hideCode: boolean; + enableSpatialAudio: boolean; +} diff --git a/src/main/GameReader.ts b/src/main/GameReader.ts index 2ddc244e..c9e30145 100644 --- a/src/main/GameReader.ts +++ b/src/main/GameReader.ts @@ -1,41 +1,33 @@ -import { DataType, findModule, getProcesses, ModuleObject, openProcess, ProcessObject, readBuffer, readMemory as readMemoryRaw } from "memoryjs"; -import * as Struct from 'structron'; +import { DataType, findModule, getProcesses, ModuleObject, openProcess, ProcessObject, readBuffer, readMemory as readMemoryRaw } from 'memoryjs'; +import Struct from 'structron'; import patcher from '../patcher'; -import { IOffsets } from "./hook"; +import { GameState, AmongUsState, Player } from '../common/AmongUsState'; +import { IOffsets } from './IOffsets'; -export interface AmongUsState { - gameState: GameState; - oldGameState: GameState; - lobbyCode: string; - players: Player[]; + +interface ValueTypeCould not connect to microphone
- - returnCould not connect to microphone
; + + return