Author Topic: PC-FX Zeroigar Translation Development Thread  (Read 2495 times)

Necromancer

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 21366
Re: PC-FX Zeroigar Translation Development Thread
« Reply #15 on: May 26, 2015, 03:27:02 AM »
Sheesh, what a mess.  :|
U.S. Collection: 97% complete    155/159 titles

elmer

  • Hero Member
  • *****
  • Posts: 2153
Re: PC-FX Zeroigar Translation Development Thread
« Reply #16 on: May 30, 2015, 08:42:12 AM »
Anyone that's played the game might know that you can use the "III" button as an alternative to the "RUN" button to bring up the Weapon Select menu.

But have you tried pressing "III" when you're already holding down the "SEL" button?

Whoops ... bug!!!  [-X

Well ... it'll be fixed in the translation.

esteban

  • Hero Member
  • *****
  • Posts: 24063
Re: PC-FX Zeroigar Translation Development Thread
« Reply #17 on: May 30, 2015, 09:40:58 AM »

Anyone that's played the game might know that you can use the "III" button as an alternative to the "RUN" button to bring up the Weapon Select menu.

But have you tried pressing "III" when you're already holding down the "SEL" button?

Whoops ... bug!!!  [-X

Well ... it'll be fixed in the translation.

Does it reset the game?

Forgive my ignorance.
  |    | 

elmer

  • Hero Member
  • *****
  • Posts: 2153
Re: PC-FX Zeroigar Translation Development Thread
« Reply #18 on: May 30, 2015, 09:54:53 AM »
Does it reset the game?

Forgive my ignorance.

Good guess! That would have been an easy mistake for them to have made.

Nope ... it pauses the game, but it doesn't bring up the Weapon Select menu ... and the music stops loading and just starts looping the last couple of seconds of sound.

When you un-pause, which has to be with the "RUN" button and not the "III" button, you've got a 60/40 chance that the music is then trashed for the rest of the level (or until you die or a voice-over is played).

I'm guessing that it's the remains of a debug menu that they didn't fully flush out of the production CD.

elmer

  • Hero Member
  • *****
  • Posts: 2153
Re: PC-FX Zeroigar Translation Development Thread
« Reply #19 on: June 12, 2015, 06:32:40 AM »
Here's a little tale for anyone that finds this kind of thing interesting ...

I develop/test in Mednafen and have only very recently started burning CDs.

For a while now, SamIAm has been seeing a rare problem with the subtitled videos that I'd never been able to see.

The original videos contain a 16-pixel high very-dark-grey border at top and bottom of the picture.

For the new videos, he's moved the original picture up by 16-pixels, and created a 32-pixel high space at the bottom of the picture for the subtitles.

The subtitles are then drawn in yellow text on a black background.

Now, this looks great, and works perfectly 99.9% of the time.

But, once-in-a-blue-moon ... something strange happens and the border of the subtitles (where there is no text) turn from black into medium-grey ... and then stay that way for the entire video.

This does not happen with the original videos, it does not happen with the new videos in Mednafen, and it only happens very rarely on a real PC-FX ... but if you stay in the Main Menu for long enough, then it will eventually happen.

Well, it took a couple of days to track down, but here's what happens (in somewhat technical detail).

The M-JPEG video chip that's in the PC-FX has a shortcut where 16x16 blocks of a video frame that are completely in a single color (usually black) can be encoded in a really, really short and efficient form.

Now, the original videos use dark-grey borders, so they never contain any of these specially-encoded blocks.

But, in the new subtitled videos, they're extremely common and surround all the yellow text of the subtitles.

The M-JPEG video chip can actually display any of these specially-encoded blocks in any color ... the color that is displayed is actually set by the game itself. This can be useful for doing things like green-screen chroma-key transparency.

So ...

1) The PC-FX is turned on, and the video-chip is reset ... this sets the color that these special-blocks display to "medium-grey".

2) The Zeroigar game starts up, and it sets the color to "black".

3) The game starts to play a video, and it resets the video chip again before playback.

4) The video is played.

Now ... the "bug" is in step 3 ... there needs to be a delay when you reset the chip; and the Zeroigar developer that wrote the code that resets the chip before a video is played didn't put one in.

So, 99.9% of the time the chip doesn't actually "reset", and the special-blocks are displayed in the "black" color that the game sets when it starts up.

But once-in-a-blue-moon, the chip actually does "reset", and that sets the color back to "medium-grey".

The original videos never use these special-blocks, so you don't see anything wrong when you're using them.

Mednafen doesn't set the color to "medium-grey" when it emulates the chip reset, so you never see anything wrong in Mednafen, with either the old or the new videos.

But, on a real PC-FX, you've suddenly got subtitles that are surrounded by ugly grey blocks.

Whoops!  :oops:

The lesson here for developers is ... always RTFM!  #-o

BTW ... the code that resets the chip at the start of the game does contain the proper delay ... so this is just another case of too-many-cooks.

[EDIT]

Added screenshots.
« Last Edit: June 12, 2015, 03:27:27 PM by elmer »

SamIAm

  • Hero Member
  • *****
  • Posts: 1835
Re: PC-FX Zeroigar Translation Development Thread
« Reply #20 on: June 12, 2015, 02:43:53 PM »
I can't tell you how pleased I am with the way things are shaping up. The end product is going to be very nice, you guys. I'll save my gushing for the release, but elmer is an absolutely fantastic hacker/programmer.

elmer

  • Hero Member
  • *****
  • Posts: 2153
Re: PC-FX Zeroigar Translation Development Thread
« Reply #21 on: June 13, 2015, 03:58:59 AM »
For anyone that's curious for an example of how the contents of a game CD are layed out on the disc, here's what I've found out about Zeroigar ...

Code: [Select]
//
// 51 code segments on CD - 42 code segments patched.
//
// PC-FX Boot   at iso 0x00000000   // Boot Info / License Info
// Startup code at iso 0x00001000 x // Boot Loader
// Startup code at iso 0x00009000 x // Main Front End
// Startup code at iso 0x00051000   // NEC & Studio Boot Screens
// Startup code at iso 0x00056000   // Art Design Slideshow - Part 1
// Startup code at iso 0x00093800   // Art Design Slideshow - Part 2
// Startup code at iso 0x00126800   // Sakurigar Mode Static Level Name Screen
//
// Video 0 data at iso 0x00129000 x // Video (1871 frames) : Story Introduction
// Video 1 data at iso 0x02129000 x // Video (1752 frames) : Before Anime Level 1
// Video 2 data at iso 0x041ea800 x // Video (1042 frames) : Title Song
// Video 3 data at iso 0x0558d000 x // Video ( 999 frames) : Middle Anime Level 1
// Video 4 data at iso 0x0697f000 x // Video ( 467 frames) : Before Anime Level 2
// Video 5 data at iso 0x0729b000 x // Video ( 399 frames) : Before Anime Level 3
// Video 6 data at iso 0x07952800 x // Video ( 596 frames) : Before Anime Level 4
// Video 7 data at iso 0x0823b000 x // Video ( 388 frames) : Before Anime Level 5
// Video 8 data at iso 0x08934000 x // Video ( 376 frames) : Before Anime Level 6
// Video 9 data at iso 0x090be800 x // Video ( 591 frames) : Before Anime Level 7
// Video A data at iso 0x09b84800 x // Video (2133 frames) : You Beat the Boss!
// Video B data at iso 0x0bd43800 x // Video ( 568 frames) : After Credits
// Video C data at iso 0x0c85b800 x // Video ( 183 frames) : Type-A Launching
// Video D data at iso 0x0cbb7000 x // Video ( 176 frames) : Type-B Launching
// Video E data at iso 0x0ceb1800 x // Video ( 177 frames) : Type-C Launching
// Video F data at iso 0x0d257000 x // Video ( 243 frames) : Sakuraigar Launching
//
// Adpcm ? data at iso 0x0d6a1800   // Start of audio data
//
// Startup code at iso 0x12566000 x // ADPCM Music Test Mode
// Startup code at iso 0x12596000   // Huge Text Printing Level Name Screen
// Startup code at iso 0x125a6000 x // Play Anime Level Intro video
// Startup code at iso 0x125aa000 x // Anime Mode, Level 3 (normal difficulty)
// Startup code at iso 0x126aa000 x // Anime Mode, Level 1 (normal difficulty)
// Startup code at iso 0x127aa000 x // Anime Mode, Level 4 (normal difficulty)
// Startup code at iso 0x128aa000 x // Anime Mode, Level 5 (normal difficulty)
// Startup code at iso 0x129ca000 x // Anime Mode, Level 6 (normal difficulty)
// Startup code at iso 0x12b0a000 x // Anime Mode, Level 7 (normal difficulty)
// Startup code at iso 0x138ba000 x // Play Sakurigar Level Intro Slideshow
// Startup code at iso 0x1393a000 x // Normal Mode Front End (between levels)
// Startup code at iso 0x13982000   // Art Design Slideshow - Part 3
// Startup code at iso 0x139ea000 x // Trial Mode (contains front end graphics)
// Startup code at iso 0x13aca000 x // Anime Mode, Level 1 (low difficulty)
// Startup code at iso 0x13bca000 x // Anime Mode, Level 2 (low difficulty)
// Startup code at iso 0x13cca000 x // Anime Mode, Level 3 (low difficulty)
// Startup code at iso 0x13dca000 x // Anime Mode, Level 4 (low difficulty)
// Startup code at iso 0x13eca000 x // Anime Mode, Level 5 (low difficulty)
// Startup code at iso 0x13fea000 x // Anime Mode, Level 6 (low difficulty)
// Startup code at iso 0x1412a000 x // Anime Mode, Level 7 (low difficulty)
// Startup code at iso 0x1428a000 x // Anime Mode, Level 1 (high difficulty)
// Startup code at iso 0x1438a000 x // Anime Mode, Level 2 (high difficulty)
// Startup code at iso 0x1448a000 x // Anime Mode, Level 3 (high difficulty)
// Startup code at iso 0x1458a000 x // Anime Mode, Level 4 (high difficulty)
// Startup code at iso 0x1468a000 x // Anime Mode, Level 5 (high difficulty)
// Startup code at iso 0x147aa000 x // Anime Mode, Level 6 (high difficulty)
// Startup code at iso 0x148ea000 x // Anime Mode, Level 7 (high difficulty)
// Startup code at iso 0x14a4a000 x // Play End-of-Game Video
// Startup code at iso 0x14b1a000   // Play End-of-Game Credits
// Startup code at iso 0x14bea000 x // Anime Mode, Level 2 (normal difficulty)
// Startup code at iso 0x14d2a000 x // Normal Mode, Level 2 (no level 1)
// Startup code at iso 0x14e2a000 x // Normal Mode, Level 3
// Startup code at iso 0x14f2a000 x // Normal Mode, Level 4
// Startup code at iso 0x1502a000 x // Normal Mode, Level 5
// Startup code at iso 0x1512a000 x // Normal Mode, Level 6
// Startup code at iso 0x1522a000 x // Normal Mode, Level 7
// Startup code at iso 0x1532a000 x // Sakurigar Mode, Level 1
// Startup code at iso 0x1542a000 x // Sakurigar Mode, Level 2
// Startup code at iso 0x1554a000 x // Sakurigar Mode, Level 3
// Startup code at iso 0x1566a000 x // Sakurigar Mode, Level 4
// Startup code at iso 0x1578a000 x // Sakurigar Mode, Level 5
// Startup code at iso 0x158aa000 x // Sakurigar Mode, Level 6
// Startup code at iso 0x15a2a000 x // Sakurigar Mode, Level 7
// Startup code at iso 0x15bd7800   // Art Design Slideshow - Part 4
// Startup code at iso 0x15c46000   // Art Design Slideshow - Part 4 (again?)
//
// END OF ISO   at iso 0x15cff800   // END OF ISO
//

SamIAm

  • Hero Member
  • *****
  • Posts: 1835
Re: PC-FX Zeroigar Translation Development Thread
« Reply #22 on: June 18, 2015, 04:37:18 PM »
Elmer is off for a few days. After the work he's put in, he certainly deserves a break. Though he'll probably want to weigh in later with his programmer's perspective, you might like to know what's going on now.

The in-game text, the in-game icons, the menus, the title screen, the continue screen, the post-death/stage-clear screen...all of that is basically in its final form, fully translated. We spent a while settling on a color for the in-game text, and I played through the game again and again to polish the display timings. It's all looking very slick.

Now, we are focusing on optimising the FMVs for quality.

-----

The process of subtitling the FMVs has always looked something like this:

1. Convert FMV files ripped directly from the game to lossless AVI. Audio is lost at this stage for whatever reason. We used tools made by some Japanese guy to do this.

2. Cut off the 16 pixel tall black-ish borders at top and bottom, apply a 32 pixel pure black strip to bottom, apply subtitles over that, and output to AVI again.

3. Take subtitled AVI and convert it with MPCONV2. This is a program included with the PC-FXGA GMAKER development kit that encodes AVIs to MIX, which is a format the PC-FX's HuC6271 video playback chip can understand.

4. Merge the audio from original rips with the .mix files produced by MPCONV2, sprinkle additional formatting fairy dust, and insert into the game.

The big deal is stage 3, where we convert the subtitled AVIs to MIX. Allow me to talk about MPCONV2 for a moment. This tool is very limited...almost as if it wasn't made with real developers in mind...and when it comes to quality, it only allows you to specify a ceiling for the data rate of the FMVs. For example, you could set it at 200KB/s, and the data rate would never exceed that as it plays the entire video.

Alternatively, you can tell it to encode at certain "Quality" settings which don't have ceilings. Quality=0 effectively tells it to use as much data as it could want, and Quality=1, 2, 3 etc. step that amount down by about 10% each successively.

-----

The PC-FX has a 300KB/s rated drive, and so until recently I had been encoding the videos with a 295KB/s ceiling (for peace of mind). Basically, this output looks very good. However, there are three problems:

1. There is a minor drop in overall quality due to lossy-encoding. Of course, the source is also lossy, but we inevitably loose just a little bit more quality on top of that. This could be alleviated somewhat if we had a higher data rate ceiling.

2. The subtitles, which are yellow, occasionally have some blue dots appear around them. They're still easy to read, but the effect is distracting. This is merely another case of compression artifacts, and its caused by moments when the video image needs an unusually large share of the bandwidth.

3. In areas with lots of black, compression artifacts can be particularly bad, and occasionally outright hideous.

About #3 - MPCONV2 gets a little overzealous with black, and occasionally it assigns black areas a special kind of 16x16 pixel pure-black block that is super-efficient in terms of data compression but god awful in terms of visual appeal. In these areas, I have been creative with video editing, introducing white fades or otherwise slightly brightening all the frames between visual cuts. Most of these additions you won't even notice, and it solves the problem satisfactorily. However, there is a slight chance that MPCONV2 could be hacked so as to never use these blocks, which would be sweet.

Please don't panic when you see that video, though. There are very few instances of this problem in the game. That one is by far the worst, and I've covered everything up pretty nicely.

-----

But now, the Big News. About a week ago, elmer made a fantastic tool that lets us look at data rates on a per-frame and per-second basis within each .mix file. This has led to many fascinating discoveries.

1. Encoded at 300KB/s, anywhere from 40-80% of the video content is actually sub-250KB/s depending on the specific FMV. It will only rise to the ceiling at certain peaks.

2. Even when encoded at the ceiling-less Quality=0 setting, the majority of the video content is still sub-300KB/s, and only a couple of seconds in all of the game's FMVs combined exceed 350KB/s.

3. Additionally, we also discovered in short order that the PC-FX is using a buffer when it streams the videos, and it can actually handle brief spikes over 300KB/s. I have tested this on real hardware. The size of the spikes it can handle would surprise you.

The result of all this is that we have a couple of interesting potential methods of improving the quality of our subtitled FMV.

One thing that I tried was to encode a video in two versions: one at 300KB/s and the other at Quality=0. Breaking down the two files into individual frames, I erased certain large frames from the Quality=0 version and replaced them with frames from the 300KB/s version. This produced something that looked very sigificantly improved, worked on real hardware, and was easy to make.

(Keep in mind that since the PC-FX's playback is JPEG based, every frame is stored completely. You couldn't do this with an MPEG format).

---------

HOWEVER...elmer has also come up with a whole other method which appears to work well.

Go alllll the way back to the beginning. You rip the FMV files from the game, you convert them to lossles AVI. Here's where things take a turn.

If you never apply the subtitles to the AVIs, and stop after having the video moved 16 pixels up and applying a 32 pixel black strip to the bottom, they compress into MIX much better. If you compare sizes of no-subs MIX output files, there is almost no difference between the ceilingless Quality=0 setting and a 300KB/s-ceiling setting (for the files I have reviewed so far, anyway).

Elmer found out something cool. I don't have a firm grasp on the technical details, but it seems you can effectively have the HuC6271 display two JPEGs at once. What we can do is to encode the video and the subtitles separately with MPCONV2, initially outputting individual files for each, then merging them into one so that they are both displayed simultanously. The result on screen is identical at a glance, but this method lets us encode the subtitles in a way that they are always flawless regardless of how busy the video image is.

However, the question here is whether the subtitles and the video can balance out nicely. If we have to drop the quality of the video to make room for the subs, then that might not be cool. If we have to lower to quality of the subs to the point that artifacts start appearing, then it's kind of pointless.

I have a lot of work to do to test this.

-----

So, we have two methods of improving the FMVs to choose from at the moment:

1. Comb high-quality, >300KB/s versions of MPCONV2 output for better frames that will still fit within buffer tolerances.

In short, the advantage of this method is that there's a natural balance between the video and the subtitles. Artifacts around the subtitles will only appear at peak moments when the image itself demands more of the data. The disadvantage, of course, is that any artifacts around the subtitles look bad.

2. Encode the subtitles separately from the video, then combine them.

The advantage of this method is that we can force the subtitles to always look clean. The disadvantage of it is that the clean subs might come at the cost of the quality of the video, though again, this would be only for brief moments, and would probably be very minor.

I am actually inclined to go with option #2, as long as the subs can be totally clean and the video not compromised beyond a negligable degree.

----

And last but not least, there are two completely separate additional solutions for making the FMVs look good.

1. Perform some programming voodoo to move the original video as-is up 16 pixels, and then add the subtitles separately like mentioned above. This is ideal in terms of quality (no additional lossiness to the image whatsoever), but possibly very difficult in terms of programing.

2. Write an entirely new compressor that encodes video in multiple passes and generally does things smarter and better than MPCONV2.

These things are complicated and challenging enough that we might wait and put out a "remastered" version sometime later.

----

Anyway, this is what I have been doing with myself for the past week or two. If you're wondering why Zeroigar is taking so long even though we've had the basic stuff done for so long, it's because getting it to look as good as it possibly can takes a while. I'm just grateful to elmer for going the extra mile with me.  :D
« Last Edit: June 20, 2015, 10:48:20 PM by SamIAm »

esteban

  • Hero Member
  • *****
  • Posts: 24063
PC-FX Zeroigar Translation Development Thread
« Reply #23 on: June 19, 2015, 12:03:25 AM »
Do you have to shift video 16 pixels up?

I was thinking: keep existence video, as-is,  but display subtitles on bottom of screen (thereby overlapping video by 16 pixels). Black outline around yellow/ white text usually accounts for any conflict with video content.

It is not elegant, but it saves a lot of work. :)
« Last Edit: June 19, 2015, 12:04:59 AM by esteban »
  |    | 

SamIAm

  • Hero Member
  • *****
  • Posts: 1835
Re: PC-FX Zeroigar Translation Development Thread
« Reply #24 on: June 19, 2015, 02:51:19 AM »
Do you have to shift video 16 pixels up?

I was thinking: keep existence video, as-is,  but display subtitles on bottom of screen (thereby overlapping video by 16 pixels). Black outline around yellow/ white text usually accounts for any conflict with video content.

It is not elegant, but it saves a lot of work. :)

For that to work, we would have to re-encode the entire bottom 16 pixel row of the video where the first row of subtitles would overlap. If we did that, line between the original video and the recoded video would probably be visible, and the quality between the two would be inconsistent.

Plus, the black-ish borders in the original videos are fuzzy with dark-grey compression artifacts that look like black borders from a super low-quality VHS tape. I'd hate to leave just one, and I'd hate to put subtitles over the other, so it's a no-win situation.

The re-encoded videos with the new pure-black 32 pixel border at the bottom look really good, if I do say so myself. There really isn't as much quality loss as you would expect (thank god this isn't MPEG), and even the 295KB/s videos preserve most of the quality of the originals. The current battle is just about squeezing every last drop of quality we can.  :D

spenoza

  • Hero Member
  • *****
  • Posts: 2751
Re: PC-FX Zeroigar Translation Development Thread
« Reply #25 on: June 19, 2015, 12:46:44 PM »
Was this game released on any other platform at all? Is there any higher-quality source for the videos to maybe re-encode?
<a href="http://www.pcedaisakusen.net/2/34/103/show-collection.htm" class="bbc_link" target="_blank">My meager PC Engine Collection so far.</a><br><a href="https://www.pcenginefx.com/forums/" class="bbc_link" target="_blank">PC Engine Software Bible</a><br><a href="http://www.racketboy.com/forum/" c

SamIAm

  • Hero Member
  • *****
  • Posts: 1835
Re: PC-FX Zeroigar Translation Development Thread
« Reply #26 on: June 19, 2015, 01:01:37 PM »
Was this game released on any other platform at all? Is there any higher-quality source for the videos to maybe re-encode?

Nope. It's a PC-FX exclusive.

SamIAm

  • Hero Member
  • *****
  • Posts: 1835
Re: PC-FX Zeroigar Translation Development Thread
« Reply #27 on: June 20, 2015, 10:31:47 PM »
I'm sorry, you guys, I was totally wrong about encoding in Quality=0 having that "rising tide" effect on certain small frames. You know, improving them but leaving them within the data rate limit of a 300KB/s-ceiling file.

What actually happens in that enabling Quality=0 allows for some frames to leap dramatically in quality. For example, if the frame-size limit of a 300KB/s file is 25KB, and a certain frame within that is 17KB, you wouldn't expect that it has room to improve. Lo and behold, however, that if you remove the size limit altogether, it might rocket up to 27KB. That's what confused me.

I edited that big post I made.
« Last Edit: June 20, 2015, 10:49:15 PM by SamIAm »

esteban

  • Hero Member
  • *****
  • Posts: 24063
Re: PC-FX Zeroigar Translation Development Thread
« Reply #28 on: June 20, 2015, 10:45:00 PM »
Still loving everything...
  |    | 

elmer

  • Hero Member
  • *****
  • Posts: 2153
Re: PC-FX Zeroigar Translation Development Thread
« Reply #29 on: June 21, 2015, 05:04:31 AM »
I'm looking forward to seeing the results of the experiments when I get back.  :)

From what I tried, "high quality" + separate subtitles gave really good results with much smaller spikes in the data rate than "high quality everything" ... it'll be interesting to see if that holds for some of the more difficult videos.