Open sekwah41 opened 2 years ago
Even if its just to learn something from the both of them, compare how the mac one works vs windows
Could possibly look into running command line and run the overlay exe within the wine prefix.
May be able to use /proc/%processid%/environ to find what to run the process with to get it running in the same environment
px aux | grep "C:/Riot Games/League of Legends/LeagueClient.exe"
Managed to spawn task manager from within the same instance remotely, need to try to find why the overlay exe is crashing
The overlay injector process seems to be able to spawn in wine just fine using the below code
const child_process = require('child_process');
const test = child_process.spawn('mobalytics_overlay.exe');
const {stdout, stderr} = test;
if (stdout) {
stdout.on('data', (data) => {
console.log(`stout data, data: ${data}`);
});
stdout.on('close', (code, signal) => {
console.log(`stout was closed, code: ${code}, signal: ${signal}`);
});
stdout.on('error', (err) => {
console.log(`stout error: ${err}`);
});
stdout.on('exit', (code, signal) => {
console.log(`stout exit, code: ${code}, signal: ${signal}`);
});
stdout.on('message', (message) => {
console.log(`stout, message: ${message}`);
});
}
if (stderr) {
stderr.on('data', (data) => {
console.log(`stderr, data: ${data}`);
});
stderr.on('close', (code, signal) => {
console.log(`stderr was closed, code: ${code}, signal: ${signal}`);
});
stderr.on('error', (err) => {
console.log(`stderr error: ${err}`);
});
stderr.on('exit', (code, signal) => {
console.log(`stderr exit, code: ${code}, signal: ${signal}`);
});
stderr.on('message', (message) => {
console.log(`stderr, message: ${message}`);
});
}
test.on('close', (code, signal) => {
console.log(`was closed, code: ${code}, signal: ${signal}`);
});
test.on('error', (err) => {
console.log(`error: ${err}`);
});
test.on('exit', (code, signal) => {
console.log(`exit, code: ${code}, signal: ${signal}`);
});
test.on('message', (message) => {
console.log(`exit, message: ${message}`);
});
test.on('spawn', (message) => {
console.log(`overlay injector spawned`, {message});
});
At least the spawn events are triggered, need to look to create a connection layer and possibly create a new process spawner exe file using https://www.npmjs.com/package/pkg with NODE_SKIP_PLATFORM_CHECK=1
to skip the main checks
Look for the best way to spawn and pipe the data back into the other side.
To test it you must use export NODE_SKIP_PLATFORM_CHECK=1
and set NODE_SKIP_PLATFORM_CHECK=1 to make sure pkg will run in wine
Easiest way to test rapidly. Create a node script which you run directly trying to test the exe. Just raw everything.
const info = child_process_1.spawn(command, {
shell: true,
stdio: ['pipe', 'inherit', 'inherit'],
env: {
...leagueVariables,
NODE_SKIP_PLATFORM_CHECK: "1"
}
});
You can spawn processes fine inside if you have console.log outputs. However you lose access to stdout and stderr, you didn't have access anyway because of wine.
Look to make a socket pipe for any that are needed and just look for the spawn other events.
More of it is now running, possibly try moving the files within the file system first and see if it fixes wine: Read access denied for device L"\??\Z:\", FS volume label and serial are not available
https://forum.winehq.org/viewtopic.php?f=8&t=33574 may be similar error
In the most recent edits league stutters (I assume its while its injecting) just need to connect the sdout and other parts now hopefully :D
Seems the error was it was trying to run from the wrong directory
The next part is trying to figure out what electron_overlay provides
Look into https://nodejs.org/api/net.html#netcreateconnectionpath-connectlistener and using it to connect info back to the other side. Possibly try to create an IPC module restructurer.
The module is creatable when the module is enabled in windows.
The main reason the overlay app can't just be run in windows is the fact that the visuals are entirely fucked for electron.
Take a look to see if it may be easier to wrap a larger part of the program in this rather than small parts. Though from now on it doesn't seem like processes but ipc messages and function calls.
Though this module at least has to be in league otherwise it cant read the league memory.
For now instead of IPC use sockets on specific ports then try to connect in and out of wine
possibly try connecting everything through one socket for now and add an identifier at the start. Or use env args to state the ports to connect through.
Seems nexe
has some of its own problems but it fixes the problem of the sdout. Should be able to use the already existing stuff to communicate with it :D though make a compat layer for the overlay provider
Error with nexe instead is `Processes utils | stderr, data: node:internal/modules/cjs/loader:1183 return process.dlopen(module, path.toNamespacedPath(filename)); ^
Error: /home/sekwah/.config/mobalytics-desktop/moba-extra-resources/overlay-module/1.0.0/win/electron_overlay.node: invalid ELF header
at Object.Module._extensions..node (node:internal/modules/cjs/loader:1183:18)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.
When switching to node windows x64-14 it seems to get Error: EINVAL: invalid argument, lstat 'Z:\'
Using a lower version of node with pkg seems to remove the issues of pkg (though havent checked importing yet)
now thats actually useful feedback, 100% recommend pkg over nexe
Seems the issue may be because its on the wrong drive C:\ -> Z:\ in wine
Copying files to a temp folder seems to do the trick
Problem is uv_pipe_open issue is back, using pkg helped and seems to be better when not using wine and this specific use case
the problem is with nexe that it seems to detect that its linux and fuck everything up
Seeing as this is taking a while come back to it, try implementing a rest service or some sort of local communication (refferably without sockets) look at the/tmp/MOBA-OVERLAY-CLIENT- /tmp/MOBA-OVERLAY-SERVER and see if that works across clients
Rather than trying to do it the "right" way just get it bloody working first.
Try to use net or whatever to just enable all calls
Major fps issues found though this may be because initMemoryScannerForLoL is called every time. Check that out.
(Quite likely something like that rather than laggy calls as it seems to get worse and worse over time rapidly)
Though killing mobalytics seems to fix it so not sure whats causing the problems especially as we cant see inside the module.
Need to look to pass the data through properly now and await the proper functions so that the data gets set. Look at lol-internal-data/lol-memory-scanner.js
It was an issue of the new code not accepting the async functions, needed to fix that then the init memory scanner stopped lagging
Just need to fix the window as the messages don't go through and then see whats wrong next
Looking at all the events being send its getting ALL of the data. I just need to force spawn the overlay and recode any parts which are being dodgy.
Heck yea :D
Seems to be something in lol-overlay-window or base-overlay-window.
game-overlay-manager createOverlayWindow isnt even called
ensureOverlayWindow in game-overlay-manager does get called
so does createOverlayWindow making a lol overlay window
The overlay window is deffo made using ensureOverlayWindow
The overlay window controller is being made but not the this.window :thinking:
Need to find why the overlay window objects exist but not the window variable inside
If its found that the windows one wont work try looking at the mac overlay as it may not need the injection
The problems may not lie in the lol overlay as the .create function is not called. It may be to do with the base overlay or something else not being able to get size data or process id's.
There seems to be an error with the overlay server path. Going to try sockets too.
May need to convert the overlay-server to connect to a port and then pipe the data from
//const CLIENT_PATH = '\\\\.\\pipe\\MOBA-OVERLAY-CLIENT-';
//const SERVER_PATH = '\\\\.\\pipe\\MOBA-OVERLAY-SERVER';
to the ports
Look to make a proxy on two unused ports for each of these files then rewrite how the base-overlay-server connects so that the injector written by mobalytics properly is connected.
See what other features e.g. the overlay and how they work.
May not be able to get it working though may be able to add info on how to get it working directly in wine?