From 4915fc6978bc42af8c074e02cc513953f0aa3b85 Mon Sep 17 00:00:00 2001 From: nitsuja Date: Sun, 1 Nov 2009 06:40:18 +0000 Subject: [PATCH] - fixed bug where trying to save two savestates in a row would load the second one instead of saving it - fixed movie recording which was totally broken by my last checkin - fixed some minor snddx buffer size problems (the default size might need to be increased now, but if so, someone else should do it, since it works fine for me as is.) --- desmume/src/movie.cpp | 7 +++---- desmume/src/windows/main.cpp | 7 +++---- desmume/src/windows/snddx.cpp | 3 ++- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/desmume/src/movie.cpp b/desmume/src/movie.cpp index 0a7a67794..1360c91d8 100644 --- a/desmume/src/movie.cpp +++ b/desmume/src/movie.cpp @@ -176,7 +176,7 @@ MovieData::MovieData() void MovieData::truncateAt(int frame) { - if(records.size() < frame) + if(records.size() > frame) records.resize(frame); } @@ -727,6 +727,8 @@ void _CDECL_ FCEUI_SaveMovie(const char *fname, std::wstring author, int flag, s assert(nds.touchX == input.touch.touchX && nds.touchY == input.touch.touchY); assert((mr.touch.x << 4) == nds.touchX && (mr.touch.y << 4) == nds.touchY); + currMovieData.truncateAt(currFrameCounter); + mr.dump(&currMovieData, osRecordingMovie,currMovieData.records.size()); currMovieData.records.push_back(mr); @@ -864,9 +866,6 @@ bool mov_loadstate(EMUFILE* fp, int size) if(!movie_readonly) { - ////truncate before we copy, just to save some time - //tempMovieData.truncateAt(currFrameCounter); // disabled because this can really screw things up and shouldn't usually be faster - currMovieData = tempMovieData; currMovieData.rerecordCount = currRerecordCount; } diff --git a/desmume/src/windows/main.cpp b/desmume/src/windows/main.cpp index 3d5c5bfd0..645d2af55 100644 --- a/desmume/src/windows/main.cpp +++ b/desmume/src/windows/main.cpp @@ -2806,7 +2806,6 @@ void CloseRom() NDS_Reset(); } -//TODO - async key state? for real? int GetModifiers(int key) { int modifiers = 0; @@ -2814,9 +2813,9 @@ int GetModifiers(int key) if (key == VK_MENU || key == VK_CONTROL || key == VK_SHIFT) return 0; - if(GetAsyncKeyState(VK_MENU )&0x8000) modifiers |= CUSTKEY_ALT_MASK; - if(GetAsyncKeyState(VK_CONTROL)&0x8000) modifiers |= CUSTKEY_CTRL_MASK; - if(GetAsyncKeyState(VK_SHIFT )&0x8000) modifiers |= CUSTKEY_SHIFT_MASK; + if(GetKeyState(VK_MENU )&0x8000) modifiers |= CUSTKEY_ALT_MASK; + if(GetKeyState(VK_CONTROL)&0x8000) modifiers |= CUSTKEY_CTRL_MASK; + if(GetKeyState(VK_SHIFT )&0x8000) modifiers |= CUSTKEY_SHIFT_MASK; return modifiers; } diff --git a/desmume/src/windows/snddx.cpp b/desmume/src/windows/snddx.cpp index ac7754b16..ac71a19d4 100755 --- a/desmume/src/windows/snddx.cpp +++ b/desmume/src/windows/snddx.cpp @@ -122,7 +122,8 @@ int SNDDXInit(int buffersize) return -1; } - soundbufsize = buffersize * 2 * 2; + soundbufsize = buffersize * 2; // caller already multiplies buffersize by 2 + soundoffset = 0; memset(&wfx, 0, sizeof(wfx)); wfx.wFormatTag = WAVE_FORMAT_PCM;