Skip to content

Commit

Permalink
feat: gosumemory gameOverlay implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
KotRikD committed Dec 16, 2023
1 parent 7580a67 commit 1b1b987
Show file tree
Hide file tree
Showing 6 changed files with 248 additions and 6 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ dist/
node_modules
yarn-error.log
static/
package-lock.json
package-lock.json
config.ini
gameOverlay/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Features Done
- [X] Gameplay information (300's, 100's, 50's, live pp calculations, other stuff)
- [X] ResultScreen information (result screen information with grades + gameplay data)
- [ ] Tournament state (in beta right now, dont have chat reading, and some output data)
- [ ] In-game overlay (kinda hard thing to make + i need some RFC for it)
- [x] In-game overlay (based on gosumemory closed overlay injection)

### 🏠 [Homepage](https://github.com/KotRikD/tosu#readme)

Expand Down
3 changes: 2 additions & 1 deletion packages/tosu/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"rosu-pp": "^0.9.4",
"ts-node": "^10.9.1",
"tsprocess": "workspace:*",
"winston": "^3.8.2"
"winston": "^3.8.2",
"@tosu/game-overlay": "workspace:*"
}
}
11 changes: 9 additions & 2 deletions packages/tosu/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ POLL_RATE=150
KEYOVERLAY_POLL_RATE=150
SERVER_IP=127.0.0.1
SERVER_PORT=24050
STATIC_FOLDER_PATH=./static`
STATIC_FOLDER_PATH=./static
ENABLE_GOSU_OVERLAY=false`
);
}

Expand All @@ -31,7 +32,8 @@ export const config = {
keyOverlayPollRate: Number(process.env.KEYOVERLAY_POLL_RATE || '100'),
serverIP: process.env.SERVER_IP || '127.0.0.1',
serverPort: Number(process.env.SERVER_PORT || '24050'),
staticFolderPath: process.env.STATIC_FOLDER_PATH || './static'
staticFolderPath: process.env.STATIC_FOLDER_PATH || './static',
enableGosuOverlay: (process.env.ENABLE_GOSU_OVERLAY || '') === 'true'
};

export const updateConfig = () => {
Expand Down Expand Up @@ -82,6 +84,11 @@ export const updateConfig = () => {
fs.appendFileSync(configPath, '\nSTATIC_FOLDER_PATH=./static', 'utf8');
}

if (!process.env.ENABLE_GOSU_OVERLAY) {
newOptions += 'nENABLE_GOSU_OVERLAY, ';
fs.appendFileSync(configPath, '\nENABLE_GOSU_OVERLAY=false', 'utf8');
}

if (newOptions !== '')
wLogger.warn(`New options available in config: ${newOptions}\n`);
};
10 changes: 9 additions & 1 deletion packages/tosu/src/objects/instanceManager/osuInstance.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { injectGameOverlay } from '@tosu/game-overlay';
import EventEmitter from 'events';
import fs from 'fs';
import path from 'path';
Expand Down Expand Up @@ -123,10 +124,17 @@ export class OsuInstance {
'PATTERN SCANNING FAILED, TRYING ONE MORE TIME...'
);
this.emitter.emit('onResolveFailed', this.pid);
break;
return;
}
}

/**
* ENABLING GOSU OVERLAY
*/
if (config.enableGosuOverlay) {
await injectGameOverlay(this.process);
}

this.update();
if (config.enableKeyOverlay) {
this.updateKeyOverlay();
Expand Down
Loading

0 comments on commit 1b1b987

Please sign in to comment.