The above video goes away if you are a member and logged in, so log in now!
I'm not that experienced with the audio-side of development so I wouldn't be able to do much of anything. Audsrv works pretty well, though, and I think it supports adpcm wav files. For some file formats, there are ports of libraries to support them in the svn repository alongside ps2sdk but I'm not sure if they use sjpcm or audsrv, or give you samples to buffer and playback.
I used audsrv for FCEUltra, since sjpcm was giving me some really scratchy sound. It was pretty simple to setup and use, but it did take some trial and error to figure out how to present the sound samples so audsrv would like them.
urbigbro, it's alright, . I don't need a desk or anything as he doesn't really cut into my time developing since he plays during the night with people on the west coast. Sometimes it's nice when I have coder's block, as getting off the computer helps me think about the problem a bit better.
I decided to just do fontx2 type fonts for now based on LbFn's support. It's a pretty standard format, and there are a few converters out there for converting fonts to fontx2. Rendering the fonts using point/line primitives will make them look better as well, and enable more effects like italics, bold, and alignment.
I also took a screenshot of the texture sample running. Pcsx2 turned the roses blue when it made the screenshot, which I think makes it look better. I'm not sure why the texture is missing on two faces of the cube. Maybe some sort of clipping, or a problem with calculating texture coordinates with math3d, .
I've got fontx2 fonts loading/rendering, but I couldn't get nika's rendering method to work, so there's no scaling. I've got a bold effect working pretty well for it, though, and multibyte font support is working so CJK native language translations can be done. Even unicode support should work, as long as the font's tables use unicode range lookup/layout and only up to double-byte range. I'm not sure if there are any out there, as most fontx2 pages seem to be in Japanese, heh.
I discovered a neat trick, as well, where I can draw 2 points per qword, thereby using half the qwords. The GIF will draw 2 points for every loop, but I'm not sure if a loop is a GIF cycle, or how many registers the GIF can set in a single cycle, so I have no idea about the performance effect. I want to implement it into the 2d primitives to optimize their size a bit, however.
There's a small drawback with using fontx2 type fonts, in that it takes a bit of processing and a lot of points to render. For example, it takes 12909 qwords to render a 256x256 block of 8x16 capital W's, or 25818 points, and 21324 qwords in bold, or 42648 points. That's about 333 kilobytes for 1/4th of a 512x512 framebuffer, or ~1.2 megabytes for a 512x512 framebuffer covered in bold text, heh. Other than that, depending on the characters used, rendering small 256 character strings will generally use less than 1500 qwords and double that for 16x16 fonts.
If you post a comment on nika's LbFn site he may be able to help with that. He has replied to all of my comments while helping figure out the custom PS2 SJIS font characters and FREEMCB.CNF editing feature.
Originally Posted by ragnarok2040
Yi may be even more helpful.
I'd post the question to them in both English, and machine translated Japanese. Better yet, if you have any friends that speak Japanese, they could translate it.
I'm glad that you're working on this as it will expose more people to the fact that many homebrew apps can be made with fontx2 fonts thus simplifying menu translation to other languages.
I have the algorithm working fine, but portions of the character are corrupted depending on their placement. I tweaked the algorithm a little to make it look a bit better, but the corruption still happens. I uploaded snapshots showing what's happening. Number 14 is using line drawing, and number 15 is using point drawing.
Raster font's don't really scale that well, hence why multiple versions for different sizes were included with dos/windows, etc. JNABK's tutorial, http://psx-scene.com/forums/showthread.php?t=62323 ([Tutorial] Font Conversion- TTF/OTF to FontX2), can be used to make fonts of different sizes for fontx2, though. They should appear better that way than using a scaler, heh.
I've got drawing strings mostly done.
It makes me wonder how Japanese PS2 developers managed to implement text drawing. It takes a lot of processing to render even a simple string using fontx2, (a thousand or so iterations per character @ 16x8), and reserving vram for bitmaps would be costly, when rendering 3d scenes, anyway. Vector/outline fonts would probably be better...
I uploaded a snapshot of the krom font in bold. I fixed a small problem where the last pixel of a character wasn't in bold causing it to look slightly lopsided. I've tried a few converted ttf fonts. Wide characters, and characters that are naturally bold don't seem to look that good, but others, like arial and such, look fine.
This reminds of the mode-8 in SNES. Few people know about it, but the SNES could to high-res graphics in mode-8, but using the DSP that normally is used for mode-7 effects such as zoon and rotating. I only know that Secrete of mana and Seiken Densetsu 3 use it for font rendering (it is funny, the fonts are hi-res but the rest of the game not.
There should be a trick such as using cache for each letter/character?
I know windows 9x-xp gets very slow if you drop, lets say, 5000 fonts, on it, probally because of some way of caching them?
I wonder if it's DSP-1, as it has instructions involving vectors and matrices which would be useful for rendering vector/outline fonts.
I don't think a cache will work as the information stored would need to be information about each point in a char instead of information about each char, resulting in quite a bit of information.
I think the best bet is to send them as each character is done using a couple of small packets. That way, the EE is working while the DMAC/GIF is working, and streamlines the process a bit.
I think I'll work on adding a bitmap font format based on Font Studio 4.1, as well, http://www.ogre3d.org/forums/viewtopic.php?f=11&t=47802. You can add outlines of desired thickness, as well as shadows. A 512x512 4-bit texture would only use up about ~32k words of vram but allow for the use of quite a few characters due to the packing algorithm. Each char would only take up a qword or two as well,. The kerning information also looks pretty easy to handle...
I've finished with the alignment calculations, which were pretty easy after I figured out I'd mixed up my loop variables. Now there's left/right/center alignment. I just need to modify it to parse multibyte strings, add a drawing function for Font Studio 4.1 fonts, and add a parser for the kerning information for those fonts.
Last edited by ragnarok2040; 03-15-2010 at 02:19 PM.
Reason: Textures aren't really optimized that much :/
Finished the FontStudio ini parsing. It's a little basic, but it should do the job. FontStudio uses UTF-8 character mappings, so unicode strings and such can be supported, making most translations relatively simple. The font loading code is variable, so the limiting factor on characters is the amount of vram a developer wants to use for the font texture.
I've been playing around with GIMP, and discovered how to swap the R/B color channels and produce 4-bit textures so it's compatible with the GS. I'll post a tutorial once I finish up the font library.
All that's left is to make string/char drawing funtions for the FontStudio fonts which should be relatively simple compared to fontx.
I see your work long ago ragnarok, and i hope you do your best in this snes project