jPSXdec is a cross-platform PlayStation 1 media decoder/converter.
Get the latest version here.

Saturday, August 15, 2009

jPSXdec forever


According to Ohloh, jPSXdec is worth at least $150,000, but that is for code from a year ago. It now has now swelled to over 28,000 lines of code in over 170 files, and will probably be past 30k LOC by next version's release.

I really wish I could work on jPSXdec non-stop until it's ready for prime time again. School, work, the economy, a seriously expensive family emergency, and some critical life changes have all conspired to make that impossible. In fact, I don't have much hope in seeing the next release available anytime this year.

Things completed so far:
* The complicated part of media playback (managing 6 simultaneous threads isn't easy)
* Much needed cleanup of the Tim decoder, XA ADPCM decoder, and serialization code
* Reorganized the arrangement of media streams verses more static types of media
* Fixed both bugs on the issue list.
* Fixed the Tim false-positive matching that happens fairly often
* Fixed FF7 frame-rate miscalculation
* Break things up by game (i.e. setup plugin system)
* ISO9660 file detection
* Improved detection of audio (including CD-i) and video media items
* More robust disc image detection

Still to do:
* Re-implement the saving process for the various media types
* Redo frame rate detection

Beyond the next release:
* Automatic error reporting
* Redo the GUI
* Append AVI writer to make it stricter so it can produce cleaner AVI files
* AVI PNG codec
* Yuv4mpeg2 writing and/or AVI YUV codec
* Real-time media playback/preview
* Searching for static demux and MDEC data
* Finding and uncompressing lhz data, often used in PSX games
* Raw direct CD reading from the disc drive (based on java-avm)
* CD-i video formats
* More game handling
* STR and XA re-encoders
* CD track audio handling

When hell freezes over:
A custom hex browser for jPSXdec. Other free and/or open source hex browsers are generally decent, but none do everything I really need. Some desired features:
* Viewing of very large files without loading the whole thing into memory (hundreds of MB)
* Quick viewing and editing values as big/little endian of varying bit sizes/signs/types
More specifically for PSX hacking
* Identifying and browsing by sector (much like CDmage and IsoBuster do)
* Highlighting of the sector headers and footers
* Viewing of continuous demuxed sector payloads
* Identification of known sector types, and the various fields in each
* An overview map of the entire CD, with quick identifying symbols/colors for every sector and its type
The closest thing I've seen to this is VirtualDub's hex viewer.

And the ultimate pièce de résistance:
* Real-time processing of the data as you mouse-over it, and showing how it results in the final output
* Allows you to take each bit of data in the disc and follow it through the entire decoding process, each step of the way
* Allow you to change anything in real-time, and see how it would turn out
I've repeatedly imagined a program like this for even just mpeg1 or 2 streams. Those streams are really complicated, and you never get to see the direct connection between the data and the output. It would be so neat to hover over a block or a macro block and be able to see exactly where it was going to end up on screen, how it will look, and everything around it. The whole motion detection as well. It would be an incredible tool to teach people how those streams work. In the almost impossible case you've seen the official Bluetooth development tools, that's exactly what I had in mind.

All these neat ideas could eventually turn jPSXdec into the ultimate PSX hacking utility.

The time frame for everything? A long...long time. Years probably. Which really makes me wonder: what will become of this project in, say, another decade? Should I start soliciting help?

In the next to impossible case someone would like to join in developing jPSXdec, his skills might hopefully include:
* Very usable knowledge of Java (no need for an expert because I don't think I am)
* Love and value for clear and well documented source code
* Some experience with reverse-engineering just about anything (media formats preferred)
Added bonus:
* General understanding of mpeg/jpeg-type image formats
* Awareness of cross-platform development issues, and/or experience with developing simple programs for multiple platforms (i.e. Windows, Linux, Mac)