-Fixed ImportFMV's movie title; before, I mistook it for the game name.
-Made "comment" and "SyncHack" constants.
-Moved the "ControllerDefinition"s outside of all of the loops.
-ImportGMV:
--Emulation Version => Movie Version.
--Added the PAL header.
--Made it so that the 6-button error is a warning; considering that the code already properly handles the controller properly and all that needs to be done is have Bizhawk actually support that kind of input, I don't feel there's a reason to go so far as to kill the conversion in this case.
--Reformatting.
---Notably, I added a player loop to simplify the frame data.
--It seems that 1937M uses a 6-button recording and 1731M has 2-player input...bizarre. Anyway, this means that ImportGMV should be good now.
TODO: ImportVMV, ImportNMV, ImportMCM, ImportSMV, Atari core? :)
-Fixed InputAdapters with regards to the Genesis 3-Button Controller. It previously did not have a flag placeholder.
Potential issues that I don't have the time to investigate right now:
-When importing 1937M, I get the error "6 button controllers are not supported." Is this a false positive?
-The result of importing 1731M seems sane, but has 2-player input. This run is classified as "One player in a multiplayer game". Is this input normal?
--Because there are way more bytes used to represent the other GUIDs than this one, I just appended -0000-0000-0000-000000000000 to this per zeromus' request.
-Got rid of the hex part of the BytesToString function. We apparently have BizHawk.Util.BytesToHexString.
-Converted BytesToString to r.ReadStringFixedAscii, an extension method. I've determined that extension methods are cool and that I should use them more often.
-Fixed some error and warning messages:
--Made it so that the first .FCM warning is shown instead of the last.
--Added an error for .FCM files that aren't version 2.
--Did the same for ImportVBM, but with version 1.
-Cleaned up comments / code throughout.
-Fixed the file format for GBx; it had an extra bar which made reading Player 1 impossible.
-Seemingly finished ImportVBM.
--The results seem same. I have no way of testing whether they sync up or not.
--As I can't actually handle additional controllers, I just skip the bytes for them.
--As I can't actually handle the miscellaneous buttons and commands (Ex. L, R, Reset), I just give warnings whenever they come up in the file.
TODO: ImportGMV, ImportVMV, ImportNMV, and maybe ImportSMV...I'm going to need a new assignment soon! :)
-Set the buttons to the opposite state when they are updated.
--Presumably, this is how this works.
-Read the delta bytes.
TODO: Figure out where in the world the writing of frames actually comes into play. Bisqwit gave me some insight on this.
-Set the buttons to the opposite state when they are updated.
--Presumably, this is how this works.
-Read the delta bytes.
TODO: Figure out where in the world the writing of frames actually comes into play.
-Added a FourScore header and applied it to ImportFile and ImportFCM.
--Not sure if there's any equivalent header for FMV/FCM.
-Seemingly have the update bytes being read properly.
TODO: Make ImportFCM actually utilize the update bytes to write frames.
-Added PAL handling to ImportText.
-Finished the header and metadata of ImportFCM.
TODO:
-Input handling for ImportFCM.
-Find out what the format for the FDS data is on FMV, as it occurs to me that I already handle FDS data in ImportText by giving warnings, so I might as well do the same thing in this case.
-Figure out whether or not I should be using "using" for the BinaryReader objects, as it seems like they do in fact have .Close() methods.
-There's "FDS data" stored in the frames of FDS recording. I have no idea how to handle this. If we do in fact support these features, they should be utilized in the TODO section provided.
-99M syncs with this...isn't this a problem? Wouldn't this imply that bizhawk is as inaccurate as Famtasia? I'm pretty sure this run didn't sync when I tried it on my now broken NESBot.
TODO: I guess I'll try to move on to ImportFCM now. Although I heard this is a difficult format to work with, my favorite console is the NES, and this'd be useful for console verification if the NESBot Lua script gets adapted for bizhawk, so I think I'll give it a shot.
-Added RemoveNull to get rid of the null characters in the author and game names for .MMV.
-Formatted the MD5 for .MMV.
TODO:
-Write ImportFMV. I think I understand how these formats work well enough to try this now.
-Realized that the the ImportMMV function probably still works, but that Grunt's Sonic run merely desyncs. If I move the second pause button one frame later, it will make it past the title screen.
TODO: Comment / clean / and understand ImportMMV before moving on to ImportFMV.
-Made it so that any of the exceptions thrown from the Import* functions get converted into a string and stored in errorMsg. Now I can investigate what's wrong with ImportFCM.
-Realized that there's already a function that decides which SMV function to import with (ImportSMV, duh), so now that's used for it. Outputs a movie with messed up headers except for the Re-record count, which works fine.
-Added format URLs for all of the movie formats except for SMV 1.52, which doesn't seem to have a documentation page yet.
--Moved the command message in ImportText to this.
-Converted ImportVBM to use a MnemonicsGenerator.
--This should work, but I can't test as I still don't know for sure as the import fails and displays "Not a valid VBM platform type."
--I iterated through the buttons using a list and left-shifting. I applied this method to ConvertMMV, which works.
TODO:
-Comment MovieImport.cs.
-Fix the exception that is thrown for Gameboy games.
-Get ImportVBM to actually work, scanning through the input to see if it seems sane.
-Figure out why pressing Pause on GameGear results in a "P" instead of a "p", and whether or not this is a factor in runs syncing.
--Note that I don't think that the calculator pad simulator is registering when I click 0, and that this doesn't seem to be related to any changes I made.
-Inadvertently fixed the seemingly broken Genesis 3-Button Controller mnemonics...the controllers weren't responding at all before. I guess refactoring and working with simplified code IS worth it. <_<
--That said, this is still really broken:
---Mnemonics don't show up while recording.
---Input goes past the frame length, and it's never labeled finished.
---Doesn't seem to sync at all.
---This exception:
---------------------------
Oh, no, a terrible thing happened!
System.Exception: unhandled opcode at pc=013648
at BizHawk.Emulation.CPUs.M68000.MC68000.ExecuteCycles(Int32 cycles) in C:\Users\Administrator\Repo\bizhawk\BizHawk.Emulation\CPUs\68000\MC68000.cs:line 147
at BizHawk.Emulation.Consoles.Sega.Genesis.FrameAdvance(Boolean render) in C:\Users\Administrator\Repo\bizhawk\BizHawk.Emulation\Consoles\Sega\Genesis\Genesis.cs:line 106
at BizHawk.MultiClient.MainForm.StepRunLoop_Core() in C:\Users\Administrator\Repo\bizhawk\BizHawk.MultiClient\MainForm.cs:line 1676
at BizHawk.MultiClient.MainForm.ProgramRunLoop() in C:\Users\Administrator\Repo\bizhawk\BizHawk.MultiClient\MainForm.cs:line 346
at BizHawk.MultiClient.Program.Main(String[] args) in C:\Users\Administrator\Repo\bizhawk\BizHawk.MultiClient\Program.cs:line 47
---------------------------
System.Exception: unhandled opcode at pc=013648
at BizHawk.Emulation.CPUs.M68000.MC68000.ExecuteCycles(Int32 cycles) in C:\Users\Administrator\Repo\bizhawk\BizHawk.Emulation\CPUs\68000\MC68000.cs:line 147
at BizHawk.Emulation.Consoles.Sega.Genesis.FrameAdvance(Boolean render) in C:\Users\Administrator\Repo\bizhawk\BizHawk.Emulation\Consoles\Sega\Genesis\Genesis.cs:line 106
at BizHawk.MultiClient.MainForm.StepRunLoop_Core() in C:\Users\Administrator\Repo\bizhawk\BizHawk.MultiClient\MainForm.cs:line 1676
at BizHawk.MultiClient.MainForm.ProgramRunLoop() in C:\Users\Administrator\Repo\bizhawk\BizHawk.MultiClient\MainForm.cs:line 346
at BizHawk.MultiClient.Program.Main(String[] args) in C:\Users\Administrator\Repo\bizhawk\BizHawk.MultiClient\Program.cs:line 47
---------------------------
OK
---------------------------
--I don't think I broke anything...if anything, I fixed it slightly so that input is at least recognized in some way.
--Question: Is Genesis going to be properly supported by release time? If so, I might hold off a Genesis TAS until this is done. I hate Gens.
-Moved BUTTONS, COMMANDS, and new variable PLAYERS, which indicates how many players are for a given system, to Global.cs.
--If there's a better place for this, please let me know.
--That said, if there are places in the code that refer to the mnemonics of button names of a given system, we should definitely apply these variables for easier modification. Please let me know where these places might be.
-Fixed ImportText(). It now only reads as many controllers as the given system supports.
TODO:
-Merge the TI-83 stuff.
-Mnemonic header.
-Comment!
-Fix the TI-83 mnemonics with the IRCs blessings.
-Port the new mnemonics to the wiki.
-Fix the importers.
--I don't think ImportMMV handles the Pause and Reset commands (Or buttons, I don't even know) covert.
-Made other commands lowercase.
-Added more mnemonics to the table.
-Added a command table. The writing of headers, as currently inconsistent, will probably be done manually, but it will still reference the table for easy modification.
TODO:
-Create a mnemonic header using the tables (Format now seemingly agreed upon is "Mnemonic |UDLRsSBA|").
-Generate button handling using the table, sandwiching this simplified code with the command handlers.
-Fix the TI-83 mnemonics (It has at least two redundancies: 1 and 2).
-Port mnemonics table to wiki page.
-Convert the remainder of the importers, working or not, from the string building method to the mnemonic generating one.
-Start working on more importers!
-Realized that FixMnemonic is useless as GetControllersAsMnemonic() + WriteMovie() = Fixed.
-Finished the NES / PCE importers, now without string builders (Thanks zeromus)!
-Converted ImportMMV to this same method.
TODO:
-Decide how's the best way to handle the mnemonic header and implement it. Apparently, anything other than a predefined header and a | is considered as a comment, so I might do something like:
comment Mnemonic format:
[0|UDLRsSBA]
-Realized that FixMnemonic is useless as GetControllersAsMnemonic() + WriteMovie() = Fixed.
-Finished the NES / PCE importers, now without string builders (Thanks zeromus)!
-Converted ImportMMV to this same method.
TODO:
-Decide how's the best way to handle the mnemonic header and implement it. Apparently, anything other than a predefined header and a | is considered as a comment, so I might do something like:
comment Mnemonic format:
[0|UDLRsSBA]
-Included System.Globalization in a using statement to be more consistent with the rest of the uses of System.
-Removed trailing whitespace while I was at it. I'm OCD and it deeply bothers me, so I'll remove it on all the files that I commit in the future. Can't imagine anyone would object.
-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.
--Created ImportFile to decide what function to use for each filetype.
---It currently automatically writes to a .TAS file, but that option will eventually only be applied when specified in the GUI, hopefully completely external from this class.
--Made IsValidMovieExtension work.
--Created LoadText to do the majority of the work that both .FM2 and .MC2 need to be done.
--.MC2 seems to work perfectly, not that it was a hard conversion!
--.FM2 seems to convert most headers correct, except for subtitles, which replaces the beginning portions of each subtitle's text with 0 0 120 4294967295. Not sure what that's about, though this sure feels like deja vu...
--I still need to switch around the order of the buttons the frames are added, but I need to find out what way I can do this without reinventing the wheel.
-Added the FixMnemonic function to Movie.cs. It currently does nothing, but my goal is to have it correct the mnemonic for all frames in a movie file based on the position of the characters.
--As of right now, ImportFile uses this.
-MainForm.IsValidMovieExtension only checks whether or not its .TAS or not now.
TODO:
-Fix the FM2 subtitles.
-Shift around the FM2 buttons.
--After completed, test a .FM2 file that should sync and see if it works, with and without FixMnemonic being used.
-Make FixMnemonic actually do something.
-Refactor code? I originally thought it'd be best to treat Movie.LoadText just like any other importer, but I think at this point it might just be best to keep these things completely separate.
-Consider the possibility of working with the binary file importers.
--Yes adelikat, I am somewhat interested, especially considering how useful it would be to have a working .FCM importer so I can compare old runs when TASing. I already was hoping to learn about .VBM and .SMV for my ButtonCount.lua script. By the way, might this be bundled with bizhawk as it is with FCEUX 2.1.6? :)
--.FM2 is no longer a valid movie extension, so it is no longer counted as such in IsValidMovieExtension.
-Reused the code from PCE controller setting for NES.
-Seem to support 4 controllers for the NES now.
-General code cleanups.
TODO:
-Input from the 3rd and 4th controllers doesn't seem to be polled properly. Figure out what's wrong here.
-The copypasta from PCE to NES could probably be made into one function. The same could be said about many other portions of this code...DRY.
-Now that the mnemonics are fixed, I will have to write a proper converter for FM2.
--Once this is done, I will try the same for PCE, even if it can currently run natively.
---Once this is done, IsValidMovieExtension might as well be removed in favor of only accepting .TAS files and converting everything else.
Only updated the new method for deriving this in MovieHeader, I'm unaware of anywhere else this information is requested as I'm still learning the system.