Post subject: Gens with FULL SegaCD savestate support
upthorn
He/Him
Emulator Coder, Active player (392)
Joined: 3/24/2006
Posts: 1802
I started working on this may 3rd. However, because I didn't have Microsoft Visual Studio, and couldn't compile, I didn't actually get down to real coding until May 13. Up until then it was just browsing through source, making lists. Anyway, you can grab it here: http://www.savefile.com/files.php?fid=2430356 The zip file includes the win32 EXE, the modified sources, and an explanation of the changes made, but no patch file, as I do not know what the source Linux coders are working with looks like. There is no Linux binary, as I do not have a Linux machine to dev on. I suggest recompiling this on your machine, because it was compiled with Microsoft Visual Studio Express, and who knows what crippling features they included. I would also note that for some reason, my compiled EXE is nearly three times the size of Nitsuja's. I don't know why this is or how to fix it. Or perhaps some kind soul with better MS Visual Studio experience will compile a version which doen't have that problem. Edit: Fixed a bug which broke Load State if 32X or Sega CD weren't started. Updated link.
How fleeting are all human passions compared with the massive continuity of ducks.
Former player
Joined: 11/13/2005
Posts: 1587
Yay! Now I (or someone else) can do a Secret of Monkey Island TAS :)
Player (71)
Joined: 8/24/2004
Posts: 2562
Location: Sweden
I will be doing a Dune TAS ASAP when there is more support for sega CD. Even though it's probably not a publishable movie it will still rock towards regular playing. I sense that it can be broken down extreamly fast.
Player (81)
Joined: 3/11/2005
Posts: 352
Location: Oregon
Nice work. I should be able to get this into grrl later tonight.
ideamagnate| .seen aqfaq <nothing happens> DK64_MASTER| .seen nesvideoagent * DK64_MASTER slaps forehead
Player (68)
Joined: 3/11/2004
Posts: 1058
Location: Reykjaví­k, Ísland
Yeah baby, now I can make my "Penn and Teller's Smoke and Mirrors" run. Of course I will first have to figure out how the hell to beat the game. :/ Thank you so much for doing this. Of course I have no idea if it actually works, but for now I'm just going to assume that it works like a dream. :D
upthorn
He/Him
Emulator Coder, Active player (392)
Joined: 3/24/2006
Posts: 1802
Sad to say, but Sega CD is not yet TASable. (Or at least, Sonic CD isn't) I don't know if this is because of seek-time issues (CD reads might not always take the same number of frames), or because of timing issues during special GFX modes, but in either case, the number of frames needed between presses is sometimes different on playback versus recording
How fleeting are all human passions compared with the massive continuity of ducks.
upthorn
He/Him
Emulator Coder, Active player (392)
Joined: 3/24/2006
Posts: 1802
Woops. Found a bug. Normal Genesis games couldn't load states. (They'd still save state fine, though). Fixed. Updated link in first post.
How fleeting are all human passions compared with the massive continuity of ducks.
Post subject: Re: Gens with FULL SegaCD savestate support
Emulator Coder, Skilled player (1311)
Joined: 12/21/2004
Posts: 2687
upthorn wrote:
I would also note that for some reason, my compiled EXE is nearly three times the size of Nitsuja's. I don't know why this is or how to fix it.
It's just UPX. Download UPX and run "upx --best gens.exe" and the filesize will decrease drastically. As for recording Sonic CD not working, I can confirm that it happens even when I don't use any savestates (not sure why, sorry) and usually sometime around the startup screen, although sometimes it does actually work pretty well. Enabling "perfect synchro" could be necessary but definitely isn't enough to fix it. One change you should make: in Load_State, there's a commented-out line that says "Reset_VDP();". I don't know why it's disabled, but without it the emulator core sometimes freezes when loading a save state, so it should be re-enabled.
upthorn
He/Him
Emulator Coder, Active player (392)
Joined: 3/24/2006
Posts: 1802
Thanks for the tips. As for Sega CD, and Sonic CD in particular, desyncing on replay, my theory is that Gens continues to generate frames while performing CD seeks & reads. And those times aren't always constant. I'm planning on trying to make CD Reads into a blocking operation, but I'm making very little headway. Any help you can offer would be much appreciated.
How fleeting are all human passions compared with the massive continuity of ducks.
Player (81)
Joined: 3/11/2005
Posts: 352
Location: Oregon
I hate to ask the obvious, but are you trying to run the game from the CD instead of a ROM image?
ideamagnate| .seen aqfaq <nothing happens> DK64_MASTER| .seen nesvideoagent * DK64_MASTER slaps forehead
upthorn
He/Him
Emulator Coder, Active player (392)
Joined: 3/24/2006
Posts: 1802
Nope When I say "CD reads", I mean "Calls to the read operation made by the Sega CD processor"
How fleeting are all human passions compared with the massive continuity of ducks.
Emulator Coder, Skilled player (1311)
Joined: 12/21/2004
Posts: 2687
upthorn wrote:
... my theory is that Gens continues to generate frames while performing CD seeks & reads. And those times aren't always constant. I'm planning on trying to make CD Reads into a blocking operation, but ...
It shouldn't need to be a blocking operation to operate consistently, unless it's running it in a separate thread (which I don't think it is). If the CD seeks and reads aren't taking a constant amount of time under the same circumstances, then the problem is probably that the functions for performing CD seeks and reads are using some variables that don't get saved and/or reset properly (or at all).
upthorn
He/Him
Emulator Coder, Active player (392)
Joined: 3/24/2006
Posts: 1802
nitsuja wrote:
upthorn wrote:
... my theory is that Gens continues to generate frames while performing CD seeks & reads. And those times aren't always constant. I'm planning on trying to make CD Reads into a blocking operation, but ...
It shouldn't need to be a blocking operation to operate consistently, unless it's running it in a separate thread (which I don't think it is). If the CD seeks and reads aren't taking a constant amount of time under the same circumstances, then the problem is probably that the functions for performing CD seeks and reads are using some variables that don't get saved and/or reset properly (or at all).
That may be, and probably is the case, however, even if fixing that leads to consistant performance on the same machine, there'd be no guarantee that the same GMV would sync on someone else's computer. And since the end goal of these mods is to make SegaCD games TASable, I'm not sure how much help it would be.
How fleeting are all human passions compared with the massive continuity of ducks.
Joined: 10/3/2004
Posts: 138
upthorn wrote:
Thanks for the tips. As for Sega CD, and Sonic CD in particular, desyncing on replay, my theory is that Gens continues to generate frames while performing CD seeks & reads. And those times aren't always constant.
I believe that's the way the hardware works, as a Sega CD setup is really two consoles - the Genesis and the Sega CD - running independently, and communicating with each other. Which means you may potentially break some games if you make that a blocking operation - but it really depends on practical compatibility and not hardware accuracy, in this case.
Emulator Coder, Skilled player (1311)
Joined: 12/21/2004
Posts: 2687
upthorn wrote:
That may be, and probably is the case, however, even if fixing that leads to consistant performance on the same machine, there'd be no guarantee that the same GMV would sync on someone else's computer.
Actually there would be a guarantee, if it's done right. As long as you can make sure the initial state of emulation is the same (which I bet is not completely true now) and that the same button sequence is pressed (which should already be the case), the CD seeks and reads should happen in the exact same emulation environment and thus (because they're just virtual delays the emulator decides on, not actual hardware delay times) those operations should last the same number of frames each time. You could try removing the delays to make CD operations not last any frames, but I'd consider that a last resort because it could alter emulation (if any games rely on the delay being there, it would introduce bugs in those games).
upthorn
He/Him
Emulator Coder, Active player (392)
Joined: 3/24/2006
Posts: 1802
Ah. Now I understand. That should work much better than what I was attempting to do, previously.
How fleeting are all human passions compared with the massive continuity of ducks.
Active player (411)
Joined: 3/16/2004
Posts: 2623
Location: America, Québec
So, what's happening with that project?