Posts for nitsuja


Emulator Coder, Experienced Forum User, Published Author, Skilled player (1300)
Joined: 12/21/2004
Posts: 2687
Bisqwit wrote:
nitsuja wrote:
The AVI output finally works?
No, but I'm optimistic that you can fix it :P
Argh, I wonder what it could be this time? I'll look at it later when I've found out... I should note that (assuming you're able to get output anything like mine) games might sound like the audio is coming out a little too early, but that's only compared to listening to it in the emulator with its sound buffer delay time - I think it's actually correctly synchronized or within 1 frame of it.
Emulator Coder, Experienced Forum User, Published Author, Skilled player (1300)
Joined: 12/21/2004
Posts: 2687
I just noticed the front page has changed - I take it GB/GBA submissions are being accepted now? (The AVI output finally works?) (As a quick answer to BoltR's question about the slowdown: I found a small table of values in the (nearly-uncommented) GBA core that determined how long to wait after doing a memory transfer, which happens frequently when new enemies or levels are coming onscreen. Memory access certainly takes some amount of time, and I have a feeling their values were accurate, but I think they weren't taking into account something like the GBA being able to simultaneously process something else while the memory is being accessed, so returning 0 instead of the values in the table actually seems to give a much better approximation of the correct timing.) Also, please note that byte 0x017 in the VBM header format has just changed: bit 3 stores 0 if the old laggy timing is enabled, 1 otherwise.
Emulator Coder, Experienced Forum User, Published Author, Skilled player (1300)
Joined: 12/21/2004
Posts: 2687
This topic has been obsoleted! For new one, visit here: http://tasvideos.org/forum/t/7468 ____ OK, a new version (latest is v20.0) is up: http://www.filespace.org/nitsuja/vba-rerecording-20.zip mirror: http://filexoom.com/files/1094/vba-rerecording-20.zip You may need this older version to play old movie files of non-GBA games: http://filexoom.com/files/1094/VBA-rerecording-19.zip This is based on VBA 1.72, modified to have full re-recording support and to be more convenient (and stable) to record with. NOTE: This version requires certain DLLs to run. You can try downloading them here, or go to http://www.dll-files.com/ and download whichever DLL files it says you're missing when you try to open the program. Here is the full source code: http://www.filespace.org/nitsuja/vba-rerecording-20-src.7z mirror: http://filexoom.com/files/1094/vba-rerecording-20-src.7z old: http://filexoom.com/files/1094/vba-rerecording-19-src.7z
Emulator Coder, Experienced Forum User, Published Author, Skilled player (1300)
Joined: 12/21/2004
Posts: 2687
I figured it out, the secondary buffer needed some GLOBAL_FOCUS type option in addition to the cooperative mode being exclusive. I've found a way to eliminate the terrible slowdown that happens sometimes in games like Metroid Zero Mission and Megaman Zero that doesn't happen on the real system. I'll retain backward compatibility by making lag an option and adding another bit to the movie flags, but people working on runs will probably want to start over anyway with the lag gone once I get a new version up... (EDIT: only affects GBA games)
Emulator Coder, Experienced Forum User, Published Author, Skilled player (1300)
Joined: 12/21/2004
Posts: 2687
I'll see about the author info formatting. Right now it's just putting whatever text Windows reads from the text field into the string. About my question, that was back when it opened the file in the constructor which made it always open with default args before I could set the arguments as it was a global static object. It's appears to be fixed now.
Emulator Coder, Experienced Forum User, Published Author, Skilled player (1300)
Joined: 12/21/2004
Posts: 2687
TNSe wrote:
I believe what you want is DirectSound->SetCooperativeLevel(HWnd, DSSCL_EXCLUSIVE)
Obviously that isn't enough, because VBA is already doing this: pDirectSound->SetCooperativeLevel((HWND)*theApp.m_pMainWnd, DSSCL_EXCLUSIVE); Any other idea how to change it? (And yes, I checked to make sure that no sound pausing functions are being called upon deactivating the app.)
Emulator Coder, Experienced Forum User, Published Author, Skilled player (1300)
Joined: 12/21/2004
Posts: 2687
BoltR, I still think it's not a bug. I downloaded the movie you posted, and in the movie, you diagonally shot the block, jumped up, shot the other block in the air, and continued quickly through the end of the room. There's no desync at all in it, your record from snapshot worked fine.
Emulator Coder, Experienced Forum User, Published Author, Skilled player (1300)
Joined: 12/21/2004
Posts: 2687
Madzombie wrote:
Are you timing from the moment you select the file? If so then I was at 24:40 at the moment I picked up the Tower of Hera pendant.
I'm pretty sure the times Omni gives are from power on (including the time it takes to get through the title screen and name and create a character). I agree it seems like the routes and the Moldorm battle can be optimized more.
Emulator Coder, Experienced Forum User, Published Author, Skilled player (1300)
Joined: 12/21/2004
Posts: 2687
TNSe wrote:
Another request, change the Cooperative level on the direct sound buffer, so that even if I switch away to another window, the gameboy keeps making sound...
I think I've tried all the possible cooperative levels and none of them had this effect, DirectSound seems to always insist the window is active to play anything, unless I'm forgetting about some setting or flag.
TNSe wrote:
For some reason, with the input, VBA always receives input, even when inactive.
Changing DirectInput's cooperative level from the default should fix this. (Will make this an option too.)
TNSe wrote:
Also please add an always-on-top option (I cant seem to find this option atm).
I saw some code to do this that was commented out, that probably means it didn't work right but I'll try it out...
Emulator Coder, Experienced Forum User, Published Author, Skilled player (1300)
Joined: 12/21/2004
Posts: 2687
Bisqwit wrote:
GDI expects 32-bit surface, and I'm using 16-bit. No work.
That's odd - my monitor is always in 16-bit mode and GDI works for me. I don't use it since I find that mode pretty inefficient at rendering, though. I believe the text is currently drawn using GDI even when nothing else is, which may be why it's so slow for you.
nitsuja wrote:
AVI is not meant to be streamable, but it works very well with MPlayer. I want to try that _popen thing in Wine however. Or maybe if you can make it a commandline flag so I don't have to wait for the next day when you're next available in case it doesn't work :)
OK, I'll make it a flag. _popen does handle "wb" differently from "w", so it'll still always use "wb". I'm also adding general-purpose debugging functionality to verify in real-time that all the frames written and number of seconds it thinks have been written are matching up between audio and video. I'm unclear about what the audio logging parameters are - there seem to be 2 rate parameters, 1 called rate and 1 called something like samples. I think I've determined that rate is the number of samples per second (44100 for me) and samples is number of samples being written at the moment, but maybe this should be more explicit in the header (I thought one of them would be the number of bytes per second but neither seems to be).
TNSe wrote:
I suggest if you write it directly to the video surface, write it *after* screenshot code, and *after* giving it to AVI writer :P
I'll make it an option to draw text either "on top of screen" (like now), "on top of game" (after filters and AVI output), or "in game" (before filters and AVI output). They already have most of the code in for doing these, I think the only reason it's currently not done is that the GB screen isn't wide enough to fit much of a message in, and certain filters (2xSaI) selectively update parts of the screen which would leave chunks of text over places that haven't changed in-game when using those filters.
Emulator Coder, Experienced Forum User, Published Author, Skilled player (1300)
Joined: 12/21/2004
Posts: 2687
Yeah, sorry about that, the topics could be merged if someone wants to do that. (But the fact that I don't own the first post of the other thread to edit it is probably the main reason it's a separate topic.) About the DLLs, should I put MFC71.DLL inside the zip file, or is that worse than referring to the location it can be downloaded from?
Emulator Coder, Experienced Forum User, Published Author, Skilled player (1300)
Joined: 12/21/2004
Posts: 2687
I found a problem where I was assuming that audio and video are being logged at the same time. It should actually stay synchronized if you use -videolog with -audiolog simultaneously. But, I'll take a look at your update, that sounds like a better solution. About the text display lag - what it actually does (in all versions of VBA) is request the video memory and ask Windows to write directly onto that, drawing the text over the game and anything else that might be there on the screen. It runs pretty well for me, but maybe that's an extremely slow operation to emulate. If you're able to change the mode from DirectDraw to something else, maybe that will help, but I'm guessing not. This is a very fixable problem, though, I can put the text in the image that's being drawn to the screen instead of on top of the screen. And I was probably wrong about _popen, but the problem for me is that it always opens it in Windows Media Player which doesn't know what to do with the data because it apparently isn't in a valid AVI format, even after some of it's been written.
Emulator Coder, Experienced Forum User, Published Author, Skilled player (1300)
Joined: 12/21/2004
Posts: 2687
OgreSlayeR: OK, I know why it's doing that, I think it can be fixed by putting some extra info in the snapshots. In the meantime you can try turning on Options->Accurate Sound Pitch to fix it, but the sound might get a little annoying... (Personally, I would use Frame Advance at 50% speed instead of normal playing at 6% speed, since it takes less time and gives more control.) BoMF: You have to hex edit the movie length number for most other emulators too. But I can fulfill that request pretty easily - since it truncates it on saving it might as well recalculate the frame count on loading.
Emulator Coder, Experienced Forum User, Published Author, Skilled player (1300)
Joined: 12/21/2004
Posts: 2687
Here is yet another version, I hope this one works acceptably well: http://nvdata.pilif.ch/VBA-rerecording-new5.zip Video should be right-side-up (I should've claimed that was an april fool's joke), and sound should be synchronized with video. And I didn't have to change either emulator core's timing as I'd thought might be necessary, so the movies people are working on now should still work. Also, I added the flags -videoScale. -hideMenu, and -pauseAt. So to fix your problem with the 1x scale not really being 1x because of the menu, you can try using -videoscale 1 -hidemenu, if you're sure you won't need to access the menu directly that session. (It actually properly detects the menu's height for me, so it's probably a Windows version difference problem.) By the way, _popen() is not what it seems like it should be (it tries to run the file in a new console window), so I had to change it back to fwrite().
Emulator Coder, Experienced Forum User, Published Author, Skilled player (1300)
Joined: 12/21/2004
Posts: 2687
OK, outputAVI probably relies on DLLs and codecs being loaded into Windows so I'm not too surprised it didn't work. I have a better idea of what's happening now after doing some more testing and putting in better debug checks, but the (pre-existing) problem is pretty major so it might take a little while longer to fix. Basically, the video isn't always output at a constant rate; sometimes the GB switches into a mode where it doesn't output video data or accept input, and that means frames don't get added into the AVI during that time even though time is passing by. It's only a few frames here and there but it causes the audio and video to drift apart in some games, and certain actions (such as leaving the Mario Land title screen) cause much more drift than others. The easiest way to fix this would be to insert dummy frames into the AVI when the emulated system is stalling its video like this. My only concern with this is that it will make the AVI slightly longer than the time calculated from the number of emulated frames, so I'm not sure if the movie file should store extra information of how many dummy frames there are, or if the time difference is within the acceptable range attributable to quirks in emulation timing and conversion to AVI. EDIT: hmm, maybe this is not as big a problem as I thought. The test AVI's I'm getting look/sound great now, with no data needing to be dropped or noticeable differences from emulation speed. Now to make the video right-side-up...
Emulator Coder, Experienced Forum User, Published Author, Skilled player (1300)
Joined: 12/21/2004
Posts: 2687
Actually no, I talked only about the stuff in your WIP 5, not the stuff I figured was a joke about "WIP 6". I didn't know you had already posted WIP 5 earlier, so I noticed it from your april fool's post and commented on it then.
Emulator Coder, Experienced Forum User, Published Author, Skilled player (1300)
Joined: 12/21/2004
Posts: 2687
It's coming out early just because I subtracted from the delay time at the beginning, not because the sound generation is preceeding the video. What I'm wondering about is why the sound in Mario Land didn't come out too early. Is there a difference because one is SGB and the other is GB? Do other games follow the same pattern, or was the sound in one manually put at a different position to show just one problem (upside-down-ness) at a time? Also, the code to add the logo seems to completely drop missing frames without adjusting the audio delay time, and it looked like the Mario Land one was missing logo frames (or it could just be my AVI player skipping).
Emulator Coder, Experienced Forum User, Published Author, Skilled player (1300)
Joined: 12/21/2004
Posts: 2687
Uh, wait a sec, is it just me or does the sound in vba-problem2.avi come too late in the video, and the sound in vba-problem2b.avi comes too EARLY the video? I thought it was off by a constant amount, do you mean it actually changes per game?
Emulator Coder, Experienced Forum User, Published Author, Skilled player (1300)
Joined: 12/21/2004
Posts: 2687
Haha! Sorry, I know exactly why it does that. Their code that strips away the black pixels also flips the whole thing upside-down as a Windows image formatting thing, I'd forgotten about that. The thing that worries me more is the audio offset. The offset I added is completely arbitrary, because there is nothing to correct, no internal source of sound-to-video lag anywhere that I can find. In fact, I output the sound at the exact same time as it would get laced into the AVI, and that stays perfectly synchronized. EDIT: actually, if you could test this with the -outputAVI flag and see if it also works that way for you, that would help a lot. The delay seems to be almost exactly 0.5 seconds, minus the 1/3 of a second I arbitrarily subtracted to try to fix it, which as you point out isn't the right way to fix it anyway. But I don't think I can output sound 0.5 seconds ahead of when I do without predicting the future. I really think it has to do with the 1 second of audio delay that the audio logging function adds the first time it's called. That's the only real difference I can find between the sound logging and the sound+video AVI output. (Perhaps a test of what happens when no audio or video delay is added would clarify things.) A miscalculation of the bytes_per_second variable would explain it completely, but I've looked many times and haven't found anything wrong with that.
Emulator Coder, Experienced Forum User, Published Author, Skilled player (1300)
Joined: 12/21/2004
Posts: 2687
Did you remember to wait a while after starting the game before you played the movie? Did you remember to play it again without closing the program after it didn't work? Did you read the submission details and make sure you're using the exact same ROM (maybe it requires the Japanese version or something)?
Emulator Coder, Experienced Forum User, Published Author, Skilled player (1300)
Joined: 12/21/2004
Posts: 2687
You probably just watched it with the wrong emulator. It has to be Snes9x 1.43 WIP, (like it says in the author's comments of the run), regular Snes9x 1.43 won't work. Also sometimes it won't work anyway and you have to start watching it again from the start to make it work. (If you see something really stupid like that, chances are it's an emulator problem and the movie isn't supposed to do that.) And of course it was an april fool's joke, it even said so right in the description.
Emulator Coder, Experienced Forum User, Published Author, Skilled player (1300)
Joined: 12/21/2004
Posts: 2687
SSVegetto: I'm not sure if anyone mentioned this, but I think Saturn's not-very-tool-assisted run of SimCity does in fact go up to 500,000 people if you view it correctly. But, why do you need to see this? That's what seems odd to me about your request for it, that you don't even give any indication that you like the game...
Emulator Coder, Experienced Forum User, Published Author, Skilled player (1300)
Joined: 12/21/2004
Posts: 2687
What are you talking about?
Emulator Coder, Experienced Forum User, Published Author, Skilled player (1300)
Joined: 12/21/2004
Posts: 2687
I would convert frame number to hex offset like so: open calc.exe, type the frame #, multiply by 2, add 256, click Hex. But, hex editing won't work here that easily, because your time attack run is lagging very differently than your test run. You actually climb up the ladder faster, and jump across the gap slower, in your test run. It shouldn't be too hard to just redo that part with frame advance, anyway. There is only 1 pixel of safety for landing, so if you get hit and fall back you're just moving too far left. The steam is wider near the top so you have to move right after jumping. And the steam is actually too wide to jump over, so you have to wait longer (and/or jump higher) after killing the enemy, long enough for it to fade out exactly when you're about to land on it, which is what you (maybe accidentally) did before. BTW, I think you should redo the "ladder of boredom" to be more interesting, for example I liked how you timed some movement to the music before, and now you mostly just sit there waiting.
Emulator Coder, Experienced Forum User, Published Author, Skilled player (1300)
Joined: 12/21/2004
Posts: 2687
Wow, I hadn't seen this before, neat... The april fool's "fast walkthrough" of smb1 does surprisingly well, 27110