Home | Forums | What's new | Resources | |
libslinga API Feedback |
slinga - Apr 21, 2023 |
slinga | Apr 27, 2023 | ||||
I tweaked the api a bit, nothing major:
C:
- added a Fini() to match Init(). - GetVersion() to get the lib version - dedicated flags field I need to think of what time format to use. The internal\cartridge saves use seconds since 1980 stored as an unsigned int. Otherwise I guess I can start porting my Action Replay code (doesn't support writing) and see how that works out. |
antime | Apr 29, 2023 | |||||
Ick. Are you really intending on supporting compilers so old they offer no boolean types? If you do, choose some other macro names than plain TRUE/FALSE that are almost certain to cause collisions (e.g. SGL defines enums with the same names, and SBL defines macros with the same names). How is the Slinga_List() function intended to work? I read it as writing up to num_saves entries to the saves array, while returning the total number of saves in saves_found. But wouldn't this require always allocating space for the worst case of 255 metadata entries? How about adding some kind of iteration capability, whether through actual iterators or a block parameter (return the next n entries/return n entries starting from x)? Make your API const-correct. Apart from general soundness, it works as documentation as you know which pointer arguments are inputs and which are outputs. There's no explicit create function, and Slinga_Write() only takes a filename parameter - how do the other fields of SAVE_METADATA get set? |
slinga | Apr 29, 2023 | |||||||||||||||||
Thanks antime, this is exactly the type of feedback I was looking for. All of your feedback was 100% spot-on, thank you.
Removed. I didn't want to include
I'm envisioning always calling SLINGA_ERROR Slinga_List(DEVICE_TYPE device_type, FLAGS flags, PSAVE_METADATA saves, unsigned int num_saves, unsigned int* saves_found); twice. First time with a 0 num_saves and it will return an buffer error but set saves_found to the correct amount. The user will then have to provide a large enough buffer.
Agreed, will do. I also starting implementing Doxygen comments for what's it worth.
I've been struggling with this part for a bit. I want to support writing saves to internal\cartridge memory AND arbitrary files for ODEs. Internal\cartridge have no concept of filename (only save_name). I was thinking something like this: SLINGA_ERROR Slinga_Write(DEVICE_TYPE device_type, FLAGS flags, PSAVE_METADATA save_metadata, unsigned char* buffer, unsigned int size); With flags set to 0: - internal\cartridge memory will use the save_name field - ODEs will use the filename field and auto create and prepend a .BUP file header With flag DIRECT_WRITE set to 1: - internal\cartridge memory will still use the save_name field - ODES will use the filename field but not prepend a .BUP file header I can also add some logic that if the filename field is NULL, use SAVE_NAME + ".BUP" as the filename. I also plan to add a Slinga_SetMetaData(PSAVE_METADATA metadata, filename, savename, comment, language, date, etc). Thanks again for your advice, I appreciate it. |
nando | May 2, 2023 | |||||
Thanks for making this, I really want to test it - it seems like such a basic function that also is a waste of time to re-invent for every project! As far as time and date code, it's amazing how a basic part of life is such a giant pain in the ass when it comes to computers and programming. IMO, if there is not already a well established standard epoch for the Saturn - I would just stick to what the standard internal memory uses (1980). Most systems I've worked with use a epoch of 1970ad (specifically, 0:00:00 UTC, January 1, 1970), but it really doesn't matter as long as it's consistent and people know what the expectation is. Are people trying to use standard C time libraries? I don't have enough experience with Saturn programming to even know if you can do that. That would be the argument I could see for using the more general standard I mentioned above. |
slinga | May 2, 2023 | |||
I'm basically splitting the backends of Save Game Copier out into a standalone lib: Save-Game-Copier/backends at master · slinga-home.... I will use only MIT code. I don't think anyone on Saturn is using the C time libraries as time() is not going to give you the current time. |
slinga | Jun 1, 2023 | |||
I uploaded a very early WIP build of the code. Partial support for reading from the Action Replay, nothing else. GitHub - slinga-homebrew/libslinga: Sega Saturn sa.... I would appreciate any feedback. |
ouiouibonjour | Oct 26, 2023 | |||
Hey @ slinga and fellow forum members, your goals for libslinga are ambitious, and I like how you're addressing multiple backup devices and seamless integration with different Saturn frameworks. Also, the AR Cheat Code functionality sounds like a clever way to shim the BUP library. One aspect that could benefit from attention is incorporating regression testing software... into your development process. As your library continues to evolve, you'll want to ensure that new updates or features don't break existing functionality. Regression testing can automate this for you. |