Skip to content

Commit 15362f1

Browse files
committed
fix: osu on linux fix and bicycle for osu-winello
1 parent 96846b5 commit 15362f1

File tree

3 files changed

+32
-4
lines changed

3 files changed

+32
-4
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.env
2+
tosu.env
23
tsosu.env
34
dist/
45
node_modules
@@ -11,4 +12,4 @@ _version.js
1112
**/tosu/gameOverlay/
1213
**/tosu/game-overlay/
1314
logs/
14-
settings/
15+
settings/

packages/tosu/src/instances/manager.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ export class InstanceManager {
8282
}
8383

8484
const isLazer =
85-
Process.isProcess64bit(processId) || lazerOnLinux;
85+
(Process.isProcess64bit(processId) &&
86+
process.platform !== 'linux') ||
87+
lazerOnLinux;
8688

8789
const osuInstance = isLazer
8890
? new LazerInstance(processId)

packages/tsprocess/src/process.ts

+27-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { dirname as pathDirname } from 'path';
1+
import { existsSync, readFileSync } from 'node:fs';
2+
import { dirname as pathDirname, join as pathJoin } from 'path';
23

34
import ProcessUtils from '.';
45

@@ -55,11 +56,35 @@ export class Process {
5556
return pathDirname(ProcessUtils.getProcessPath(this.handle));
5657
}
5758

58-
// If using osu-winello
59+
// If using wine (not symlinked into image)
5960
if (
6061
process.platform === 'linux' &&
6162
this.getProcessPath().match('wine-preloader')
6263
) {
64+
// bicycle for osu-winnello
65+
// I swear a god, I will create a delete osu-winnello repo PR
66+
// if you guys will break this
67+
const homeEnv = process.env.HOME || '';
68+
const xdgDataHome = process.env.XDG_DATA_HOME || '';
69+
const shareFolder =
70+
xdgDataHome !== ''
71+
? xdgDataHome
72+
: pathJoin(homeEnv, '.local/share');
73+
const osuWinelloPath = pathJoin(shareFolder, 'osuconfig/osupath');
74+
75+
if (existsSync(osuWinelloPath)) {
76+
// osu-sinello script installation found
77+
return readFileSync(osuWinelloPath, 'utf-8').trim();
78+
}
79+
80+
const overridenOsuPath = process.env.TOSU_OSU_PATH || '';
81+
if (overridenOsuPath !== '') {
82+
// for other genius, who have their custom wine prefixes
83+
// with symlinking or other breaking default cwd????
84+
// tldr should be like: /home/kotrik/.local/share/osu-wine/osu!
85+
return overridenOsuPath;
86+
}
87+
6388
return this.getProcessCommandLine()
6489
.slice(2)
6590
.replace(/\\/g, '/')

0 commit comments

Comments
 (0)