Coder Social home page Coder Social logo

protofall / crayon-utilities Goto Github PK

View Code? Open in Web Editor NEW
13.0 2.0 1.0 193 KB

A bunch of tools related to the Sega Dreamcast

License: BSD 3-Clause "New" or "Revised" License

Makefile 0.51% C 97.15% Python 2.34%
vmu dreamcast savefile eyecatch lcd

crayon-utilities's People

Contributors

protofall avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

wgr7

crayon-utilities's Issues

VmuLcdIconCreator: Larger Preview option

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.

VmuLcdIconCreator: Greyscale icons

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.

Fix Wiki Compressed DTEX example

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.

SavefileIconCreator project

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:

  1. Its not terminal based. So unlike texconv and the programs I've been making lately it can't be easily integrated into a build process like I have with Crayon.
  2. It doesn't handle alpha at all. As in when it gets a texture it overlays it on top of a 32 by 32 white square basically removing the alpha channel.
  3. Sometimes the output isn't correct. For example one time I made a "Nerstr" icon with it and some pixels that should have been transparent/white were black and yellow.
  4. There's no way to make a multi-frame "IMAGE.BIN" without stitching together multiple binaries together, and even so the palettes most likely won't line up

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...))

VmuLcdIconCreator: Preview program option

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)

Savefile Image Creators: Better colour reduction algorithm

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)

DtexToRGBA8888: BUMPMAP support

This should be relatively straight forward, I've left comments in the code explaining how the format works and where to add conversion code.

VmuEyeCatchCreator

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.

  • Mode 1 is 72 * 56 * 2 / 512 = 15.75 blocks
  • Mode 2 is ((72 * 56) + (256 * 2)) / 512 = 8.875 blocks
  • Mode 3 is ((72 * 56 * 0.5) + (16 * 2)) / 512 = 4 blocks

Each 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.

IP.BIN creator: Terminal version

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

  • Region (Default all)
  • Media ID?
  • Media Config?
  • Manufacturer's name/ID
  • Selected Peripherals??? (I really don't get this one)
  • App title
  • Release Date (Set to current system)
  • First read file name (Default 1ST_READ.BIN)
  • Product number?
  • Version
  • Icon path (Default blank) (Also a 16 colour check with error if more)

VmuLcdBitmapTool: Proper PNG preview

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.

VmuEyeCatchCreator: Mistake in help

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.

DtexToRGBA8888: Mipmap support

A bunch of stuff will need to be re-written for this to work right. Do note these things:

  • Mipmaps must be square, twiddled and not strided
  • YUV422 textures have their 1-by-1 mipmap in the RGB565 format since YUV422 can only represent pairs of texels.

Investigate sound for the DC

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

VmuSfIconCreator: Support for more than 16 colours

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.