protofall / crayon-utilities Goto Github PK
View Code? Open in Web Editor NEWA bunch of tools related to the Sega Dreamcast
License: BSD 3-Clause "New" or "Revised" License
A bunch of tools related to the Sega Dreamcast
License: BSD 3-Clause "New" or "Revised" License
Add a new parameter to this program and if present along with the png output parameter, output a png at 192 by 128 resolution (4 times larger). Use nearest Neighbour filtering to upscale it.
Due to have a VMU's LCD works, when a pixel changes from on to off it kind of "fades out". This means by quickly changing the VMU LCD's icon you can make it appear such that the screen is displaying a greyscale image. Falco Girgis say there is a theoretical spectrum of 255 colours/fames (Kinda like a byte)
When implemented #define MAX_FADE_FRAMES to be 255 or 16 or something, and you scale the grayscale value by that. Play around with it and see what works best. Mess with the sensitivity based on how many colours you can actually see.
Also note the fade is exponential, kind of like y = e^(-5x)
since later frames look very similar.
Output a struct containing an array of the bitmaps (One per "frame"), a timer/"framerate", a frame count (bitmap array size). People have mentioned ideas where each bitmap should have a timer/counter, but I don't really get why we need that per frame.
The example shown doesn't make sense. It claims its a 16BPP non-paletted texture that was 16 wide by 16 high. However the image shows a 4-by-4 meta-texel layout (16 texels per meta-texel instead of the usual 4). Either this should be changed to say it was an 8 wide by 8 high texture or it was a PAL4BPP texture.
There is an existing program made by MrNeo240 that can be found here:
https://hkowsoftware.com/dreamcast/index-pc.html
One of its purpose is to take in a texture, scale it to 32 by 32 if not already. Convert it to ARGB4444, 4BPP palette, give some slider options I don't fully understand then create "IMAGE.BIN" and "PALETE.BIN" files. Its a great and useful tool, but I see 4 points of improvement:
My solution is to make a new program using libpng to load a set of png (And my png_assist.cpp/h) and then process them into a "IMAGE.BIN" of 512 * n
bytes (Where n is the number of frames) and the corresponding "PALETTE.BIN". It will be called like so:
./PngsToSavefileIcon --input frame1.png frame2.png --output-image IMAGE.BIN --output-palette PALETTE.bin *[--preview] *[_Png name_]
or
./PngsToSavefileIcon --input-crayon frames_all.png --output-image IMAGE.BIN --output-palette PALETTE.bin *[--preview] *[_Png name_]
The preview parameter is optional and will create a preview PNG showing what the result will look like. the difference between --input
and --input-crayon
is that the later takes a png in the same format as Crayon's animations (Aswell as a .crayon_anim
file with the height/width/frames info (But height/width should always be 32...))
Similar to texturepacker's preview, it will make a preview of what the icon looks like (32bpp monochrome). See if stb_image has a way to revert back to PNG (If not then reverse engineer it for a PNG method)
Both the savefile icon creator and eyecatcher creator programs use K-means to reduce the total colour count to under 16 or 256 colours, however is almost never chooses K colours and often looks bad. Research for better algorithms. One that came to mind is this:
Keep all the code the same, except instead of calling K-means we find the 16 most common colours in our image (Colour 1 appears 36 times, colour 2 appears 33 times, etc). Then maybe we refine them so the colours blend better (Be cautious of centroids merging and we lose colours)
This should be relatively straight forward, I've left comments in the code explaining how the format works and where to add conversion code.
This program will be very similar to VmuSfIconCreator and have a lot of shared code. This program will take a single png of dimensions 72 by 56 as well as a "mode" value (1, 2 or 3). For mode 1 it just creates an argb4444 binary with no palette. For mode 2 it makes a PAL8BPP argb4444 binary (256 palette entries) and mode 3 is PAL4BPP argb4444 (16 entries). Note that it wouldn't be wise to start this until Issue #8 is implemented since this program will need that code as well.
Unlike the savefile icon, when making a savefile with an eyecatcher, it only has a pointer for "the eye catcher data", this means you must bundle the image and palette into one binary. I have no idea if its image then palette or palette then image, but I'm going to guess its the latter.
Note: The eye catchers will take up blocks of space in your savefile.
72 * 56 * 2 / 512 = 15.75
blocks((72 * 56) + (256 * 2)) / 512 = 8.875
blocks((72 * 56 * 0.5) + (16 * 2)) / 512 = 4
blocksEach VMU can store up to 200 blocks (Or 244 if you hack it) so keep this in mind when choosing your mode. Also don't forget each frame of a normal icon is 1 Block and then there's the other header data + savedata.
As far as I know, a program like this doesn't exist. Talk with MrNeo240 about it since he has something related to IP.BINs already. Maybe he's already done this?
I'd imagine it would either be able to take a "config" file or just a bunch or params via command line such as
This would render the bitmap as a png, this is useful for debugging, but also greyscale bitmaps so you can see what each frame should look like.
When an incorrect command is entered into these programs, they should display a message showing how to use it with the format and parameter information.
I noticed that in this information for the EyeCatch program, the program's name in the example is incorrect instead referring to the savefile icon creator program.
A bunch of stuff will need to be re-written for this to work right. Do note these things:
I already know about KOS' the sndsfx library, the ogg playback library and a bit about CDDA playback and I did a bit of research before on how they work. But off the top of my head I don't remember all the details and I also feel there is more to learn
The icons need to be in the format PAL4BPP ARGB4444 meaning we have a palette of only 16 colours. For the initial version of the program I have decided to make it so textures with more than 16 colours will cause an error to be thrown and the program to end.
With this issue I plan to change it so that we detect if there's more than 16 colours and use an algorithm to reduce it to the best 16 colours. I'm currently looking at "Mean-shift" algorithm, but that could change.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.