xrip / master-gear

Very basic (300 lines of code) but working Sega Master System and Gamegear emulator
1 stars 0 forks source link

Cross Platform Support #1

Open deltabeard opened 5 days ago

deltabeard commented 5 days ago

Nice project!

I think there's a great opportunity for this program to be a cross platform library. So platform functions like CreateThread should be set by a frontend application and past to the library in a context struct. Global variables like VRAM and CRAM should also be in the struct, for example.

At least as a starting point, windows.h should be removed, and MiniFB should also be used for the audio functions, and C11 threads.h should be used for creating and using threads as it's now supported on the latest version of Visual Studio (or you can use https://github.com/PerformanC/CThreads or an alternative cross-platform threads library).

Thanks.

xrip commented 5 days ago

Thank you for suggestions! I have used hardforked and stripped down version of minifb only for windows. About structs and so on, my target is embedded platforms such as RP2040, where structures overhead can add perfomance impact. That's also why i'm using minifb -- just a framebuffer. Threads aren't neccesary, audio can be played in same thread of emulation process.

I'll update sources with cross platform version of minifb soon, and check for any simple (as minifb) cross platform audio lib.