Jump to content

Serum cross-platform library


zedrummer

Recommended Posts

  • Content Provider
Posted

Hello

 

I have coded a cross-platform open-source C library to use Serum files inside your own programs.

It is available here https://github.com/zesinger/libserum with all the explanations on how to use it.

 

Only tested on Windows x86 for now, but the release for Windows x64, Android Arm64, Linux x64, MacOS, MacOS x64 and MacOS Arm64 are available too.

If you test on any of these platform, please report here.

 

Many thanks to @mk47 for his help on the Github stuff

 

Thanks

David

Posted

Looks good for the beginning. I plan to experiment a bit with this. However, some comments on improvements:
You're using a lot of untyped byte-buffers for data structures that are not bytes. E.g. palette and rotation are fixed-length buffers. Why not use an array of structs for these? This would make the code more readable and the compiler can do type-checking without any impact on performance.

If there is interest in this I can work on this and create a PR.

  • Content Provider
Posted

Hello and thanks for your interest.

When you say "Looks good for the beginning", do you mean that you see many features that are missing? I think the format is complete. Certainly, there will be some additions, but as such, it can colorize any ROM, no?

The reason why I don't use such data structures is because, for me, the content of these buffers is always use as a block. I never specifically need to read the green component of the 13th colour, the rotations are transfered like that to the devices.

Moreover, the DLL is in C and is, for now, mainly used in DMD-extensions, in C#. I have been coding in Assembler and C. But C# and all this OO programming is a pain in my ..., so it was way easier for me to use simple byte buffers as parameters to communicate between them than structures.

Posted

The problem with a 'block' is that the compiler cannot do any range checking at all. Using structs and arrays allows at least some minimal checks and would make the code easier readable. 

If there is no specific interest from your side I won't touch this code and probably just do a C++ wrapper around to implement a typed API.

Posted

While theoretically C# can be used cross-platform, no one seriously uses it outside the Windows ecosystem. Therefore, I wouldn't even try as this would complicate things seriously.
I understand why it's used in Windows applications, but serious cross-platform libraries are either C or C++ (modern C++ has definitely a lot advantages to C, but you don't want to use this).

  • Content Provider
Posted

C# is not my choice, but initially the Serum file format was aimed to be used with DMD-extensions.

And, object-oriented coding is too much for my messy brain! C is perfect for me and the easier to use with other languages I think.

  • Content Provider
Posted

@usul27 Only WIPs, but you can easily run ColorizingDMD, colorize the 2 or 3 first frames shown at rom start and use it to check if it works. (put a colour rectangle in the middle of the frame and that's enough to be sure it works)

 

Posted

Ok, I'll wait until some colorisations are available. I'll probably reimplement the algorithm directly in C++. 
One thing that's missing in the API today is some kind of trigger on specific frames or sprites. 

  • Content Provider
Posted

Moving to C++ should be really easy (way easier than C<->C#). Do you intend to generate a C++ DLL?
Be careful not to mimic the behaviour of VNI and PAC files, the Serum file format relies on frames and not on animations. Each format has to go its own way. Why do you need this triggers?

  • Content Provider
Posted

Hello @usul27 with the joined file, you should have this display when running Champion Pub when the ROM "cp_16" starts if Serum is working:

 

 

 

The color rotation is only working with compatible device (VirtualDMD with freezy's DmdDevice.dll and with ZeDMD, for the moment). As I suppose you will use your own code and if you don't use ZeDMD, you'll only have the blue gradient with no colour rotation. But that will be enough to be sure that Serum is working as expected.

 

I hope it will help :) !

 

cp_16.cRZ

Archived

This topic is now archived and is closed to further replies.

×
  • Create New...