zeta0134 / LuaGB

A gameboy emulator written in pure Lua. Work in progress.
BSD 3-Clause "New" or "Revised" License
412 stars 35 forks source link

Add Garry's Mod backend #8

Closed meepen closed 7 years ago

meepen commented 7 years ago
1. run gmod_build.bat
2. lua_openscript_cl luagb/main.lua

Things done: require replaced with implementation-defined luagb.require for backend and general api compatibility. (I'm looking at you Garry's Mod..) Love API wrapper for Garry's Mod. Some unpack calls in graphics module changed structure of game_screen in graphics module changed

A side note, I would completely understand if you didn't want another backend clogging the main repo. But it might be nice to have a unified place to have all the backends.

Thanks so much for working hard on this! I will continue looking to make improvements on it in the future.

zeta0134 commented 7 years ago

Okay, this is really impressive! I'm not going to discount how quickly you got that ported and it makes me really happy. One critique though: modifying the core (everything in /gameboy) shouldn't be necessary to fix the require issue. I think a better approach would be to modify main.lua and define a global function named require() which does what the original function would do. I'll need to do this later for a ComputerCraft implementation, which is still planned assuming I can get some sort of graphics solution figured out. I suspect something like this will be needed on any Lua implementation that lacks full filesystem support.

I do plan to split off the File Browser and make it not Love2D specific. The existing implementation... okay, it was thrown together in like 2 days of haste, and is really quite a mess. I may re-do most of it actually. It should be much more easily portable than it is, and that's all on me.

Anyway, I won't include the Gary's Mod frontend here for planning reasons, but only because I plan to split the project anyway. I've been talking with cromo, and we both agree it would be best to split off the Love2D frontend / shell code into its own repo, and have it depend on the LuaGB core. That separates the projects; I'll maintain the Love2D implementation as the reference frontend and get it cleaned up and polished, and anyone else can maintain their own frontends (Gary's Mod, ComputerCraft, someone suggested World of Warcraft? Crazy, but technically possible) without needing to alter the core emulator code in most cases. I'll try to keep a running list of working / actively maintained frontends, and this one definitely goes on my watch list. Great work. :D

meepen commented 7 years ago

I think a better approach would be to modify main.lua and define a global function named require() which does what the original function would do. Unfortunately in Garry's Mod there's already a function called require, which makes overriding it a complete hastle since it's such trash. It basically only looks in a folder called lua/modules or for binary modules in lua/bin, so I think the best approach for games that don't have a require function have it in your own little library, but that's just my thoughts, if you have something better it's fine by me!

Anyway, I won't include the Gary's Mod frontend here for planning reasons, but only because I plan to split the project anyway. I've been talking with cromo, and we both agree it would be best to split off the Love2D frontend / shell code into its own repo, and have it depend on the LuaGB core.

That sounds great as long as everyone can help keep the list up-to-date!

Thanks for all the work you've put into this!