desmume icon indicating copy to clipboard operation
desmume copied to clipboard

LINUX - Lua on Linux

Open theCapypara opened this issue 4 years ago • 7 comments

Hi,

I wanted to use the Lua interface of Desmume and compiled it from the AUR. Lua is a build and runtime dependency of Desmume it seems, but I can't find any way to load a lua script on the Linux version.

Am I missing something or is it not implemented?

Also:

  • I'd need a way to load Lua scripts on Mac, Windows and Linux on Desmume from CLI, is this possible on any of the platforms yet?
  • Is it possible to build the posix frontend on Mac and Windows?

I'd be very interested in getting Lua to run on all platforms to be able to script the emulator using an external application.

I hope it's okay to ask these questions here, I couldn't really find a better place for it. Is there maybe a Discord / mailing list etc. or something for such questions?

theCapypara avatar Mar 20 '20 16:03 theCapypara

it's not implemented.

  1. no, but I suppose it would be easy enough on windows
  2. no, but I suppose you could if you put a lot of work into it there is only IRC for such questions.

in recent days bizhawk has got experimental melonds support, and it supports lua as well. it probably doesn't work on linux yet, but it might eventually. bizhawk kind-of works on linux and mac, and more work is done on that every day. you might find that whatever you're actually trying to do might be better done in another way (extension to bizhawk)

zeromus avatar Mar 20 '20 18:03 zeromus

Ah, that's too bad. The Bizhawk support for Linux seems pretty early, there aren't even builds for Arch yet, and I don't think what I want to do would really be good for a plugin.

It's very specific for a game and I wanted to integrate it into a ROM editor for the game. A kind if debugger for it's script engine.

Do you think it would be hard to add Lua support for Linux and/or add flags for running Lua on startup on the platforms? I feel like most of what's needed is already there (the lua engine is part of the core, right?). It kinda feels like a "so close, yet so far" situation. :confused:

Sadly I personally have 0 experience with C++, so I don't think I could help.

theCapypara avatar Mar 20 '20 20:03 theCapypara

I don't think it would not be extremely hard to add lua support for linux. It hasn't been done because nobody cares. That suggests you shouldn't care, either.

zeromus avatar Mar 20 '20 20:03 zeromus

I started working a version of DeSmuME that has a binary interface (DLL/SO) and can be used from external apps, like my Python code. I already re-implemented the Linux Glade frontend and also have it running under Windows. Will add the utility functions from Lua there.

Might open a PR here once that's done, in case it might be useful in any way. If you are interested, the code is here: https://github.com/SkyTemple/desmume/tree/binary-interface

theCapypara avatar Mar 26 '20 22:03 theCapypara

It's looking decent. I assume the ability to make the crusty old win32 non-sdl version of desmume remains intact, right?

zeromus avatar Mar 26 '20 22:03 zeromus

Yeah, I "forked" the Visual Studio project and stripped it down, the original Windows version shouldn't be affected. I did have to make some changes to the core, and haven't tried building the "classic" Windows version again, but it should still work.

Haven't gotten OpenGL to work with the Windows version yet, and haven't tested OpenAL or joysticks on it, but I would test that before opening a PR.

It was actually a really smooth process to create this so far, the core is pretty well built for something like this!

theCapypara avatar Mar 26 '20 22:03 theCapypara

you need to not call your version the "windows" version or else things will get confusing. Call it the SDLWindows version for instance.

zeromus avatar Mar 26 '20 22:03 zeromus