News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Inquiry into supporting PNG via a faux SNES 'chip'  (Read 4428 times)

Kiyoshi Aman

  • RHDN Patreon Supporter!
  • Hero Member
  • *****
  • Posts: 2261
  • Browncoat Captain
    • View Profile
    • Aerdan's Blog
Inquiry into supporting PNG via a faux SNES 'chip'
« on: October 31, 2011, 07:42:44 am »
Earlier today, a discussion was had in #rhdn about repro doods. In the course of that discussion, I suggested a faux chip for SNES games which provides PNG decoding and graphics handling, which incidentally would permit 24-bit colour (with 8-bit alpha channel). Emulator-wise, this should be trivial—most sane emulators already employ libpng in order to take PNG screenshots. The purpose for this post, however, is to determine how it would work in ROM and what would need to happen, precisely, to implement support for it.

(I'm tentatively dubbing this 'chip' the AGU-1 (Aerdan's Graphics Unit), with Agumon for a mascot, but if you folks want to call it something else (aside from 'shit', 'retarded', etc.), feel free.)

Nightcrawler

  • Hero Member
  • *****
  • Posts: 5760
    • View Profile
    • Nightcrawler's Translation Corporation
Re: Inquiry into supporting PNG via a faux SNES 'chip'
« Reply #1 on: October 31, 2011, 10:41:52 am »
I don't believe it's possible. The SNES PPU hardware will not be able to display beyond 15-bit color and short of hijacking the video signal with some really fancy hardware (probably entirely new PPU unit, VRAM, and CGRAM) I don't think any special chip is going to be able to change that either.

If your goal is simply to load PNG files and conform them to the SNES format and color restrictions, they it's entirely possible with a chip that would decompress and convert the PNG data. To do that, you'd design your chip to respond to a few select memory addresses that are both accessible and not mapped elsewhere. The rest is dependent on your design. How many memory addresses does your chip need and what would be the communications protocol to tell it to fetch data and feed the results back. The code in the ROM would access the registers and handle the communications. An emulator would emulate the co-processesor end of things. This is assuming you limit yourself to PNG data sizes that fits in normal ROM space. Otherwise, you'll need to add external media access or something like that.
TransCorp - Over 20 years of community dedication.
Dual Orb 2, Wozz, Emerald Dragon, Tenshi No Uta, Glory of Heracles IV SFC/SNES Translations

Kiyoshi Aman

  • RHDN Patreon Supporter!
  • Hero Member
  • *****
  • Posts: 2261
  • Browncoat Captain
    • View Profile
    • Aerdan's Blog
Re: Inquiry into supporting PNG via a faux SNES 'chip'
« Reply #2 on: October 31, 2011, 11:13:47 am »
Yeah, I talked to grinvader & kode54 about it while I was waiting for the post to be approved, and they made many of the same points you did. I'm not really suited for discussing the PPU stuff, though, so I'll take your (and their) word for it.

Beyond that...I think the first version would be limited to just PNG decoding, with an opaque scratch buffer for the decoder itself and another 1-2k of RAM for the game to put PNG data into for processing—I'd have to experiment with 16-bit PNGs to see if this is overkill or not (2k almost certainly will be, but not sure about 1k), though.

(ETA: Okay. Preliminary testing with 8-bit PNGs indicates 1024 bytes for shunting data to the chip isn't enough—48x48 exceeds it. I might actually suggest going as high as 4k bytes of RAM.)

(ETA 2: ...I should've stuck with my original thought of 16k RAM, though double that would probably be safer. 256x256 (actually 256x142, but meh) ends up being over 9k, optimized.)
« Last Edit: October 31, 2011, 11:46:10 am by Kiyoshi Aman »

tomaitheous

  • Hero Member
  • *****
  • Posts: 543
    • View Profile
    • PC Engine Dev
Re: Inquiry into supporting PNG via a faux SNES 'chip'
« Reply #3 on: November 23, 2011, 03:47:24 pm »
Just curious, why specifically the PNG format?

Kiyoshi Aman

  • RHDN Patreon Supporter!
  • Hero Member
  • *****
  • Posts: 2261
  • Browncoat Captain
    • View Profile
    • Aerdan's Blog
Re: Inquiry into supporting PNG via a faux SNES 'chip'
« Reply #4 on: November 23, 2011, 08:12:33 pm »
It's open-source, it's lossless, it's already used in most (sane) emulators for screenshot purposes so additional instrumenting won't be difficult beyond that necessary to provide the faux chip to the SNES itself.

Darkdata

  • Full Member
  • ***
  • Posts: 121
  • People who hurt others to feel better are idiots.
    • View Profile
Re: Inquiry into supporting PNG via a faux SNES 'chip'
« Reply #5 on: December 02, 2011, 02:43:37 pm »
I think you may be confusing things here Kiy. Sure emulators support taking PNG screenshots, but that's not part of the emulation itself, it's part of the interface.

It would be like saying that the SNES should be able to load savestates because the emulator supports it.

Kiyoshi Aman

  • RHDN Patreon Supporter!
  • Hero Member
  • *****
  • Posts: 2261
  • Browncoat Captain
    • View Profile
    • Aerdan's Blog
Re: Inquiry into supporting PNG via a faux SNES 'chip'
« Reply #6 on: December 02, 2011, 08:14:11 pm »
No, I am simply making the assumption that the hard part is not integrating PNG into the emulator, but rather, integrating PNG into the emulator such that ROMs can make use of the format.

benjaminshinobi

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
    • benjaminsantiago.com
Re: Inquiry into supporting PNG via a faux SNES 'chip'
« Reply #7 on: February 03, 2012, 03:12:56 am »
Hey are there any updates with this project?
I'm interested in the idea eventhough I'm not sure how it would work programmatically. How would you include the .PNG in the program if ultimately you are going to put it into an snes compatible format? (ie background mode 0 with only 4 colors per layer or other strange cases)
I'm starting to get back into SNES programming and I think it would be really useful "to the community"/future if there was a tool to more easily convert between PNG and SNES file formats. The .PCX converting is strange and archaic and the pcx2snes tool is kind of unreliable/wonky for me especially on windows 7 64-bit. And if you had stuff like custom labels, splitting the bytes in different files...etc that would be amazing.

Kiyoshi Aman

  • RHDN Patreon Supporter!
  • Hero Member
  • *****
  • Posts: 2261
  • Browncoat Captain
    • View Profile
    • Aerdan's Blog
Re: Inquiry into supporting PNG via a faux SNES 'chip'
« Reply #8 on: February 03, 2012, 03:47:10 am »
This concept was specifically for injecting PNG images into SNES ROMs and using them directly, not for conversion between PNG and SNES-friendly bitmap formats. It's not actually viable for a number of reasons, one being that PNG-compressed images tend to be bigger than any format used by SNES games.