-Fixed the infinite loop caused by Movie.FixMnemonic. That was dumb.

-Removed the FCEUX handling from SubtitleList.AddSubtitle; it didn't work at all, which is good because we no longer support FM2 natively anyway!
-Added MovieImport.AddSubtitle, which parses FM2 subtitles and forwards them to the .TAS movie object.
--For the color, I used 16777215 as it seems the subtitles use decimal instead of hexadecimal...why?
--Even though I used this color, which is definitely the equivalent of FFFFFF (white), the subtitles show up as black. I don't think this has anything to do with the importer, but it's worth looking into.
This commit is contained in:
brandman211 2012-02-15 19:31:11 +00:00
parent 145830d5a4
commit 213b347779
3 changed files with 22 additions and 4 deletions

View File

@ -335,6 +335,7 @@ namespace BizHawk.MultiClient
while (frame < Log.Length())
{
// TODO: Correct mnemonics, using Log.GetFrame(frame))?
break;
}
lastLog = frame;
}

View File

@ -71,6 +71,25 @@ namespace BizHawk.MultiClient
return str;
}
private static bool AddSubtitle(ref Movie m, string subtitleStr)
{
if (subtitleStr.Length == 0)
return false;
Subtitle s = new Subtitle();
int x = subtitleStr.IndexOf(' ');
if (x <= 0)
return false;
// Remove the "subtitle" header from the string.
string sub = subtitleStr.Substring(x + 1, subtitleStr.Length - x - 1);
x = sub.IndexOf(' ');
if (x <= 0)
return false;
// The frame and message are separated by a space.
string frame = sub.Substring(0, x);
string message = sub.Substring(x + 1, sub.Length - x - 1);
m.Subtitles.AddSubtitle("subtitle " + frame + " 0 0 200 16777215 " + message);
return true;
}
private static Movie ImportText(string path, out string errorMsg, string emulator)
{
@ -130,7 +149,7 @@ namespace BizHawk.MultiClient
}
else if (str.StartsWith("subtitle") || str.StartsWith("sub"))
{
m.Subtitles.AddSubtitle(str);
AddSubtitle(ref m, str);
}
else if (str[0] == '|')
{

View File

@ -136,9 +136,7 @@ namespace BizHawk.MultiClient
}
catch
{
s.Message = str; //Assume it is a FCEUX subtitle
subs.Add(s);
return true;
return false;
}
x = str.IndexOf(' ');