Closed anyputer closed 6 years ago
I personally barely know anything about the actual Libretro API, but here are some important things:
Libretro API Header: https://github.com/libretro/RetroArch/blob/master/libretro-common/include/libretro.h
Libretro Website: https://www.libretro.com/
Oh and I mentioned the possibility of an Libretro port on the Libretro forums so maybe the Libretro devs can come help? https://forums.libretro.com/t/not-yet-ported-open-source-emulators-you-want-to-see-in-retroarch/9281/70
You can check some links in the develop part, libretro-samples repository for example and also on the doc.
If you have any question please come to the channel #libretro.
Thank you.
The core seems ideal for a port except that it's quite tangled up with SDL as far as I can see. Is it possible to remove the SDL dependency?
After ~15 minutes
I see one problem in addition to SDL. There is some internal throttle mechanism (which we don't need). Is there any way to disable it?
Impressive work, thanks! Including SDL audio code inside the core was a very bad decision from the beginning due to my poor understanding of how it worked at that time. The throttling is due to audio timing, so it should be taken out from the core. I will be spending some time this week to refactor the audio properly.
BTW, you can try disabling sound, this should disable frame synching.
void GearboyCore::EnableSound(bool enabled)
Already? That is very cool!
Since I feel like not being useless, here is the core info file:
https://1drv.ms/u/s!AvB-c2zUfIalpwhX-jGwGNgOQ7c4
The bios stuff might need to be changed. So there, I saved you ten seconds! :D
We got it working, with sound too. Sound's a bit off pitch and a bit crackly but it works
hey are these legal? https://github.com/libretro/Gearboy/blob/master/src/boot_roms.h
Is it just the boot logo and sound?
Not sure, they are from here: http://gbdev.gg8.se/wiki/articles/Gameboy_Bootstrap_ROM Can be removed if there is any problem though, doesn't add too much
Seems they are ripped from the original hardware, you shouldn't include that. I don't expect anything to happen from that but it's better to play safe.
I just made a refactor to remove any reference to SDL inside the core. I also removed the boot roms and fixed sound with libretro. Now it runs pretty well, thanks for all the help. I'm going to start working on RAM/RTC access and other features.
I just compiled it and it just shows a black screen... when you toggle menu, it shows something? At least the audio sounds nice!
Windows 64-bit .dll of the Gearboy Libretro core: https://1drv.ms/u/s!AvB-c2zUfIalsQ6_LO-j7aGholHZ
Sorry, silly mistake, it's working properly now.
Thank you so much! Oh, and when are we going to have core options? ( The different palettes as seen in the screenshots, for example )
Wait... are .gearboy files saves? Those should not be in the directory where the ROM is, but it should be in the frontend's saves folder ( For RetroArch that's RetroArch/saves, not sure about other frontends :P ) I think you should use:
#define RETRO_ENVIRONMENT_GET_SAVE_DIRECTORY 31
/* const char ** --
* Returns the "save" directory of the frontend.
* This directory can be used to store SRAM, memory cards,
* high scores, etc, if the libretro core
* cannot use the regular memory interface (retro_get_memory_data()).
*
* NOTE: libretro cores used to check GET_SYSTEM_DIRECTORY for
* similar things before.
* They should still check GET_SYSTEM_DIRECTORY if they want to
* be backwards compatible.
* The path here can be NULL. It should only be non-NULL if the
* frontend user has set a specific save path.
*/
It's annoying seeing .gearboy files everywhere. Unless you want standalone Gearboy to work immediately, which really only requires renaming the file from .srm to .gearboy and putting it in the right directory. This would also allow other cores to use the saves! And if you are wondering if the saves actually work in other cores... of course!
Yes you're completely right. The core is very basic right now, I will be adding all this features over the next days.
Hey, one of the maintainers of libretro/docs here.
https://docs.libretro.com/library/gearboy/
Do you want the report core issues link at the bottom of the page to link to your issue tracker?
You're free to let us know if you want something changed in the doc or you can go ahead and contribute directly at the libretro/docs repository. What gets put on the doc is 100% under your control and approval.
Oh, many thanks! Yes, a link to this issue tracker would be great.
So, let's try to get further with this: Questions:
Here is the sameboy implementation: https://github.com/libretro/SameBoy/blob/master/libretro/libretro.c#L480
Do you have serialization/savestate support? If so, do you have an API to get/set the data to be serialized/unserialized into a buffer? we have no support for file fallbacks on this aspect
Do you have rumble support? It's optional
Do you have an API to read/write from RAM? we use this for RetroAchievements support, it's fully optional
Again the sameboy implementation: https://github.com/libretro/SameBoy/blob/master/libretro/libretro.c#L381
With those in place we would have a more or less complete core. (I should try to fix sound though)
I'm working on save states and memory access, wouldn't take me too much.
No rumble support, I can look into it.
What's the problem with sound? I thought I fixed that myself.
Ah I haven't checked the libretro core in a while, I'll check and report back :)
you're right, it's completely fine now
Hey, just wondering, do you have link cable support? Recenly hooked it up for another core :P
Nope :(
Just FYI, I updated the fork so we're up-to-date with you. I'll try standalone to try to expose any options you may have in your frontend.
Memory access is mostly finished. Retroarch can save RAM including RTC data but I can't get achievements to work.
I will be working on save states now.
I'm working on "develop" so you don't get noise until finished.
Ok, made some progress using RETRO_ENVIRONMENT_SET_MEMORY_MAPS correctly, now I have some achievements :smile:
I've finished adding achievements, ram and rtc saves, save states, soft patching, core options and reset so I consider it complete.
I'm closing the issue now, thanks for all the help.
I'll may add cheats in the future but that's a story for another day.
It's a nice idea. Any help, info, indications or whatever are welcome 😀