jbrandwood / liberis

MIT License
7 stars 2 forks source link

Bunch of examples for ADPCM, CD-DA and 8/16/32bpp image #2

Open gameblabla opened 2 years ago

gameblabla commented 2 years ago

TLDR: They are working, except for ADPCM not working on channel 1.

The 32bpp image has been converted with the b2k tool from GMAKER. (I couldn't quite figure out that color mode) The 8/16bpp examples have been converted with my BMP2HUC tool instead.

I originally wanted to have a bunch of text being displayed in BG1 with BG1 set to 4BPP mode. However, i actually can't seem to force the print functions to draw to BG1 for some reasons, even in 8bpp mode. It just draws on the first background.

The CD-DA code was inspired from oldrover's post and ADPCM code was lifted straight from him on the forums.

ADPCM, i could get it to work OK but only on the first channel. Trying to play on the second channel will result in the PC-FX BIOS sound playing instead... Interesting. I'm guessing that it's leftover memory that i didn't clear ? This example could also be modified to lift the data straight from the CD instead but for now, it's done through loading an array. Either way should work. To convert the audio, i used your wav2vox tool that you released on your HuC fork.

I just need to fix the ADPCM code before i can consider it ready.

Sidenote : I also bought a PC-FX and it should arrive within the next 3 months.

jbrandwood commented 2 years ago

I'm so glad that you're taking an interest in the PC-FX again! :-)

I think that you're obviously on the right track with a lot of this stuff, but it seems like your excellent new examples need some time to get everything working before they're ready to add to the repository.

I don't know what's going on with the ADPCM, but you can probably solve that one yourself with more experimentation.

The CDDA looping problem looks like it's from you using the wrong SCSI commands.

The PC-FX will respond to command 0x48, but that's a newer SCSI-2 command that the PC-FX's CD-ROM only partially supports (there is definitely NO "mode" parameter).

The commands that you should be using for audio playback are NEC's earlier vendor-specific 0xD8 and 0xD9 commands. This is clearly the case from looking at Mednafen's source code, and the old NEC CDR75 documentation.

If you want to keep on chatting, why not come over to the homebrew section of the PC Engine Bible forums, that's were you can find me. https://pcengine.proboards.com/

I'll post some links to the documentation there.

Best wishes,

John

gameblabla commented 2 years ago

CD-DA Track looping now works and i made sure to provide it as a high-level CDROM function within liberis itself. Now i just need to clean up the ADPCM code and i think it should be good for merging...

gameblabla commented 2 years ago

Up : I finally found the AGE tool (although the Japanese one, not the unofficial english translated one) and was able to get an 8bpp image to be displayed. Note that the palette one was going to be a little tricky so i took your RGB2YUV code and quickly came up with a tool to convert BMP palettes to YUV as oldrover's tool was unfortunately programmed in BASIC and i couldn't get it to work without wine. Not to mention the formatting he chose... My tool converts straight to a C array.

https://github.com/gameblabla/bmp2yuv

I also cleaned up the ADPCM code as i didn't realize the initialization could at least be done through liberis so i did that. There's still the issue with channel 1 that i can't get it to work...