Diesel-Net / kiwi-8

CHIP-8 interpreter for Windows and MacOS
GNU General Public License v3.0
17 stars 1 forks source link

Linux? #17

Open tomdaley92 opened 7 years ago

tomdaley92 commented 7 years ago

I'll get to it eventually.

ebachard commented 7 years ago

Thanks a lot for sharing your code, mainly for the gui part, and the Core code organization, extremely interesting !

I'm mostly using Linux, and work at something completely different, it would be great to have a working port on Linux too.

FYI, I tested the Windows version on Linux, using wine64, and it works fine ( ~ 62 fps)). Readind the code, I think I have understood what is missing (mostly the open file binding), but I don't see anything blocking the port.

=> If nobody else beats me, and I can find some time, I'll create the missing tree, and I'll try to make it compile and work on Linux too** :-) Just be patient ;-)

** x86_64 / Debian like / SDL2 / Open GL / gtk 2.x

Edit: typos + missing information

tomdaley92 commented 7 years ago

Hey, thanks for taking the time to test this under Wine!

You've hit it right in the ballpark when it comes to the only thing breaking portability, being the OpenFileDialog() functions. I opted to use the platform specific ones for Windows and MacOS, but it shouldn't be too hard to follow the pattern and add the Linux function to the open_file_dialog headers. If you've got the time I'd say go for it. I think it would be awesome to have a Linux release as well!

ebachard commented 7 years ago

Ok ... I got it working on Linux (Intel x86_64 for the moment), but I don't have the time to commit anything, and I'd prefer test in private first. Is there a way to contact you in private ? (e.g. by email ?) ... and to send you the full thing ?

Currently : I can open all the roms provided with the repository (not tested the sound though), without issue, even the Left/Right ALT work nicely. The little issue I found is the fullscreen mode : we should add a delay in the loop, because it can sometimes be difficult to toggle fullscreen/window mode. The reason : the loop is far too fast, and add some SDL_Delay() after toggleFullscreen/ window mode, should be a nice workaround. Though, got no idea about the sound (I'm not rom specialist, sorry ;-)

The "file open" implementation uses the simple nativefiledialog from https://github.com/mlabbe/nativefiledialog (see https://github.com/mlabbe/nativefiledialog/blob/master/LICENSE for the license). Last, I wrote a Makefile (based on the Mac OSX one), and a README file explaining all the dependencies + how to build the binary.

Important: in fact, I'm using gtk-3 ... apologies (I announced gtk-2)

Edit : typos

ebachard commented 7 years ago

More simple => I finaly forked your tree, and you can test directly.

tomdaley92 commented 7 years ago

Thanks for sharing the native_file_dialog library. I had no idea that existed!

I'm not sure I'm following you about the full-screen toggling issue though. Hitting the 'enter' key or clicking the corresponding GUI button toggles to full-screen or back without any issues on Windows and MacOS for me (and it feels very responsive as well!)

The main emulator loop already uses SDL_Delay() to keep the program going at about 60Hz. Adding a delay after toggling full-screen (or anywhere else, to be honest) would mess up the timing and create an apparent "stutter" in the emulated game (although that would be reasonable since the user is in fact toggling to full-screen). I personally like having the feeling of a "quick" full-screen change. In other words I would prefer to not have it feel "sluggish" on purpose. Maybe I misunderstood what you were saying. Any chance you could clarify?

ebachard commented 7 years ago

You're welcome :-) As I wrote, I learned a lot reading your code. Feel free to integrate what you want from the fork I created (see : https://github.com/ebachard/Kiwi8 ). In meantime, I have modified the style I use in another application I'm writing (not public yet) + added a new font used on Linux only for the moment.

Back to the fullscreen issue, the loop is probably too fast on Linux. I didn't test enough to tell more. As workaround, I'm hiting a second key while typing Enter. This slows down the SDL loop, and it works most of the time.

tomdaley92 commented 7 years ago

Nice, looks good so far! I will definitely use some of this and I'll be happy to add your name and contribution on the next release. Again, not sure when I'll get around to testing and polishing all of it, but this has been a huge help 👍 .

Ah, I see what your saying about the fullscreen toggling issue. Yea it sounds like something funky might be going on behind the scenes with SDL_GetTicks() on Linux.. I'll need to look into that some more. Im glad my code could help you out with whatever project you're working on, best of luck, and thanks again!