mcclure / emu-coop

Lua scripts for turning 1-player games into 2-player games using inventory sharing.
72 stars 21 forks source link

Linux support #25

Open Demon0no opened 5 years ago

Demon0no commented 5 years ago

The readme makes it look like it's just dropping some binaries into the folder to make this work under linux, but says nothing about how to actually run the script on linux?
I compiled the latest version of snes9x-rr for linux to give this a try, but I don't see a way to load lua files anywhere... Has anyone actually ever gotten this to run on a non-windows system?

mcclure commented 5 years ago

I've never run it on a non-windows system. There's someone who has a mac version nearly working but they can't get IUP working there.

SNES9X-RR should have a "load lua" script in the file menu. If it doesn't it either isn't SNES9X-RR or is some very different of SNES9X-RR than the one I use. Here is the one I built on Windows: https://github.com/mcclure/snes9x-coop Which I do not know if that will compile out of the box on Linux.

Compiling SNES9X for Linux is not enough because you will also need Linux versions of Luasocket and IUP [a UI library]. You have to build both of these as .so files and put them in the directory where the .dll files currently are. These are very standard lua libraries so this part should not be hard if you look into it.

I apologize for the difficulty.

mcclure commented 5 years ago

That reminds me— have you seen the main project webpage? It won't help you in this case, but the information on it is much more helpful than the README of this repo.

Demon0no commented 5 years ago

I've built the libraries and everything, that's not the problem. The problem is, that the win32 target doesn't compile on linux, the unix (commandline version) and gtk targets from that repo both compile and run fine but they don't seem to have any option to load/run lua files.

mcclure commented 5 years ago

Okay. I think I see the problem.

My snes9x-rr fork has this Lua console window https://github.com/mcclure/snes9x-coop/blob/master/win32/luaconsole.cpp triggered by this menu item https://github.com/mcclure/snes9x-coop/blob/master/win32/rsrc/snes9x.rc#L1017

The GTK code https://github.com/mcclure/snes9x-coop/blob/master/gtk/src/snes9x.ui#L1044 Just… … … doesn't have this. Nobody ever added it. I think what you would want to do is add a new menu item to snes9x.ui, and you would want to call RunLuaScriptFile, as on this line https://github.com/mcclure/snes9x-coop/blob/master/win32/luaconsole.cpp#L662 You would not have to create the big complicated dialog box that the windows version has. For snes9x-coop what we're really interested in is running one script, coop.lua, so you could hardcode that path, and you do not actually need to show the script printout. coop.lua opens its own dialog boxes (using IUP) and it displays text on screen when it needs to tell you something.

I think that this would not be very difficult. But it would be hard for me to do because I do not have a Linux machine to test on. Since you have a working GTK test machine set up— Do you have C development experience? Do you think you could make a patch if I walked you through it?

Demon0no commented 5 years ago

I have C experience, so no need to walk me through it. The lines you posted should be enough for me to add this feature. Not sure when I'll have time for it, but I'll probably do it at the weekend.

mcclure commented 5 years ago

Cool, curious to know how that works out.