void FCEUMOV_HandleRecording() { if(movieMode == MOVIEMODE_RECORD) { MovieRecord mr; const UserInput &input = NDS_getFinalUserInput(); DesmumeInputToReplayRec(input, &mr); assert(mr.touch.touch || (!mr.touch.x && !mr.touch.y)); //assert(nds.touchX == input.touch.touchX && nds.touchY == input.touch.touchY); //assert((mr.touch.x << 4) == nds.touchX && (mr.touch.y << 4) == nds.touchY); mr.dump(osRecordingMovie); currMovieData.records.push_back(mr); // it's apparently un-threadsafe to do this here // (causes crazy flickering in other OSD elements, at least) // and it's also pretty annoying, // and the framecounter display already conveys this info as well. // so, I'm disabling this, at least for now. // osd->addFixed(180, 176, "%s", "Recording"); } /*extern uint8 joy[4]; memcpy(&cur_input_display,joy,4);*/ }
void FCEUMOV_HandleRecording() { if(movieMode == MOVIEMODE_RECORD) { const UserInput& input = NDS_getFinalUserInput(); MovieRecord mr; mr.commands = 0; if(input.mic.micButtonPressed == 1) mr.commands = MOVIECMD_MIC; mr.pad = nds.pad; if(input.buttons.F) mr.commands = MOVIECMD_LID; if(movie_reset_command) { mr.commands = MOVIECMD_RESET; movie_reset_command = false; } mr.touch.touch = input.touch.isTouch ? 1 : 0; mr.touch.x = input.touch.isTouch ? input.touch.touchX >> 4 : 0; mr.touch.y = input.touch.isTouch ? input.touch.touchY >> 4 : 0; assert(mr.touch.touch || (!mr.touch.x && !mr.touch.y)); //assert(nds.touchX == input.touch.touchX && nds.touchY == input.touch.touchY); //assert((mr.touch.x << 4) == nds.touchX && (mr.touch.y << 4) == nds.touchY); mr.dump(&currMovieData, osRecordingMovie,currMovieData.records.size()); currMovieData.records.push_back(mr); // it's apparently un-threadsafe to do this here // (causes crazy flickering in other OSD elements, at least) // and it's also pretty annoying, // and the framecounter display already conveys this info as well. // so, I'm disabling this, at least for now. // osd->addFixed(180, 176, "%s", "Recording"); } /*extern uint8 joy[4]; memcpy(&cur_input_display,joy,4);*/ }
bool MovieRecord::Compare(MovieRecord& compareRec) { //Check pad if (this->pad != compareRec.pad) return false; //Check Stylus if (this->touch.padding != compareRec.touch.padding) return false; if (this->touch.touch != compareRec.touch.touch) return false; if (this->touch.x != compareRec.touch.x) return false; if (this->touch.y != compareRec.touch.y) return false; //Check comamnds //if new commands are ever recordable, they need to be added here if we go with this method if(this->command_reset() != compareRec.command_reset()) return false; if(this->command_microphone() != compareRec.command_microphone()) return false; if(this->command_lid() != compareRec.command_lid()) return false; return true; }
void ReplayRecToDesmumeInput(const MovieRecord &theRecord, UserInput *theInput) { if (theInput == NULL) { return; } if(theRecord.command_reset()) { NDS_Reset(); return; } else { movie_reset_command = false; } const u16 pad = theRecord.pad; theInput->buttons.R = (((pad>>12)&1)!=0); theInput->buttons.L = (((pad>>11)&1)!=0); theInput->buttons.D = (((pad>>10)&1)!=0); theInput->buttons.U = (((pad>>9)&1)!=0); theInput->buttons.T = (((pad>>8)&1)!=0); theInput->buttons.S = (((pad>>7)&1)!=0); theInput->buttons.B = (((pad>>6)&1)!=0); theInput->buttons.A = (((pad>>5)&1)!=0); theInput->buttons.Y = (((pad>>4)&1)!=0); theInput->buttons.X = (((pad>>3)&1)!=0); theInput->buttons.W = (((pad>>2)&1)!=0); theInput->buttons.E = (((pad>>1)&1)!=0); theInput->buttons.G = (((pad>>0)&1)!=0); theInput->buttons.F = theRecord.command_lid(); theInput->touch.touchX = theRecord.touch.x << 4; theInput->touch.touchY = theRecord.touch.y << 4; theInput->touch.isTouch = (theRecord.touch.touch != 0); theInput->mic.micButtonPressed = (theRecord.command_microphone()) ? 1 : 0; }
void FCEUMOV_HandlePlayback() { if(movieMode == MOVIEMODE_PLAY) { //stop when we run out of frames if(currFrameCounter == (int)currMovieData.records.size()) { FinishPlayback(); } else { UserInput& input = NDS_getProcessingUserInput(); MovieRecord* mr = &currMovieData.records[currFrameCounter]; if(mr->command_microphone()) input.mic.micButtonPressed = 1; else input.mic.micButtonPressed = 0; if(mr->command_reset()) NDS_Reset(); if(mr->command_lid()) input.buttons.F = true; else input.buttons.F = false; u16 pad = mr->pad; input.buttons.R = (((pad>>12)&1)!=0); input.buttons.L = (((pad>>11)&1)!=0); input.buttons.D = (((pad>>10)&1)!=0); input.buttons.U = (((pad>>9)&1)!=0); input.buttons.T = (((pad>>8)&1)!=0); input.buttons.S = (((pad>>7)&1)!=0); input.buttons.B = (((pad>>6)&1)!=0); input.buttons.A = (((pad>>5)&1)!=0); input.buttons.Y = (((pad>>4)&1)!=0); input.buttons.X = (((pad>>3)&1)!=0); input.buttons.W = (((pad>>2)&1)!=0); input.buttons.E = (((pad>>1)&1)!=0); input.buttons.G = (((pad>>0)&1)!=0); input.touch.touchX = mr->touch.x << 4; input.touch.touchY = mr->touch.y << 4; input.touch.isTouch = mr->touch.touch != 0; } //if we are on the last frame, then pause the emulator if the player requested it if(currFrameCounter == (int)currMovieData.records.size()-1) { /*if(FCEUD_PauseAfterPlayback()) { FCEUI_ToggleEmulationPause(); }*/ } //pause the movie at a specified frame //if(FCEUMOV_ShouldPause() && FCEUI_EmulationPaused()==0) //{ // FCEUI_ToggleEmulationPause(); // FCEU_DispMessage("Paused at specified movie frame"); //} // it's apparently un-threadsafe to do this here // (causes crazy flickering in other OSD elements, at least) // and it's also pretty annoying, // and the framecounter display already conveys this info as well. // so, I'm disabling this, at least for now. // osd->addFixed(180, 176, "%s", "Playback"); } }
//the main interaction point between the emulator and the movie system. //either dumps the current joystick state or loads one state from the movie void FCEUMOV_AddInputState() { #if defined(WIN32) && !defined(DINGUX) if (movieMode == MOVIEMODE_TASEDITOR) { // if movie length is less or equal to currFrame, pad it with empty frames if (((int)currMovieData.records.size() - 1) < (currFrameCounter + 1)) currMovieData.insertEmpty(-1, (currFrameCounter + 1) - ((int)currMovieData.records.size() - 1)); MovieRecord* mr = &currMovieData.records[currFrameCounter]; if (isTaseditorRecording()) { // record commands and buttons mr->commands |= _currCommand; joyports[0].log(mr); joyports[1].log(mr); recordInputByTaseditor(); } // replay buttons joyports[0].load(mr); joyports[1].load(mr); // replay commands if (mr->command_power()) PowerNES(); if (mr->command_reset()) ResetNES(); if (mr->command_fds_insert()) FCEU_FDSInsert(); if (mr->command_fds_select()) FCEU_FDSSelect(); if (mr->command_vs_insertcoin()) FCEU_VSUniCoin(); _currCommand = 0; } else #endif if (movieMode == MOVIEMODE_PLAY) { //stop when we run out of frames if (currFrameCounter >= (int)currMovieData.records.size()) { FinishPlayback(); //tell all drivers to poll input and set up their logical states for(int port=0;port<2;port++) joyports[port].driver->Update(port,joyports[port].ptr,joyports[port].attrib); portFC.driver->Update(portFC.ptr,portFC.attrib); } else { MovieRecord* mr = &currMovieData.records[currFrameCounter]; //reset and power cycle if necessary if(mr->command_power()) PowerNES(); if(mr->command_reset()) ResetNES(); if(mr->command_fds_insert()) FCEU_FDSInsert(); if(mr->command_fds_select()) FCEU_FDSSelect(); if (mr->command_vs_insertcoin()) FCEU_VSUniCoin(); joyports[0].load(mr); joyports[1].load(mr); } //if we are on the last frame, then pause the emulator if the player requested it if (currFrameCounter == currMovieData.records.size()-1) { if(FCEUD_PauseAfterPlayback()) { FCEUI_ToggleEmulationPause(); } } //pause the movie at a specified frame if (FCEUMOV_ShouldPause() && FCEUI_EmulationPaused()==0) { FCEUI_ToggleEmulationPause(); FCEU_DispMessage("Paused at specified movie frame",0); } } else if (movieMode == MOVIEMODE_RECORD) { MovieRecord mr; joyports[0].log(&mr); joyports[1].log(&mr); mr.commands = _currCommand; _currCommand = 0; //Adelikat: in normal mode, this is done at the time of loading a savestate in read+write mode //If the user chooses it can be delayed to here if (fullSaveStateLoads && (currFrameCounter < (int)currMovieData.records.size())) currMovieData.truncateAt(currFrameCounter); mr.dump(&currMovieData, osRecordingMovie,currMovieData.records.size()); // to disk currMovieData.records.push_back(mr); } currFrameCounter++; extern uint8 joy[4]; memcpy(&cur_input_display,joy,4); }
//the main interaction point between the emulator and the movie system. //either dumps the current joystick state or loads one state from the movie void MOV_AddInputState() { if(LagFrameFlag == 1) LagFrameCounter++; LagFrameFlag=1; if(movieMode == MOVIEMODE_PLAY) { //stop when we run out of frames if(currFrameCounter >= (int)currMovieData.records.size()) { StopPlayback(); } else { strcpy(MovieStatusM, "Playback"); MovieRecord* mr = &currMovieData.records[currFrameCounter]; //reset if necessary if(mr->command_reset()) PCE_Power(); if(mr->command_power()) PCE_Power(); NDS_setPadFromMovie(mr->pad); } //if we are on the last frame, then pause the emulator if the player requested it if(currFrameCounter == (int)currMovieData.records.size()-1) { /*if(FCEUD_PauseAfterPlayback()) //TODO: Implement pause after playback? { FCEUI_ToggleEmulationPause(); }*/ } } else if(movieMode == MOVIEMODE_RECORD) { MovieRecord mr; mr.commands = _currCommand; _currCommand = 0; strcpy(MovieStatusM, "Recording"); int II, I, n, s, u, r, d, l; for (int i = 0; i < currMovieData.ports; i++) { pcepad = pcejin.pads[i]; #define FIX(b) (b?1:0) II = FIX(pcepad &(1 << 1)); I = FIX(pcepad & (1 << 0)); n = FIX(pcepad & (1 << 2)); s = FIX(pcepad & (1 << 3)); u = FIX(pcepad & (1 << 4)); r = FIX(pcepad & (1 << 7)); d = FIX(pcepad & (1 << 6)); l = FIX(pcepad & (1 << 5)); mr.pad[i] = (FIX(r)<<5)| (FIX(l)<<4)| (FIX(u)<<7)| (FIX(d)<<6)| (FIX(I)<<3)| (FIX(II)<<2)| (FIX(s)<<1)| (FIX(n)<<0); } mr.dump(&currMovieData, osRecordingMovie,currMovieData.records.size()); currMovieData.records.push_back(mr); } currFrameCounter++; /*extern u8 joy[4]; memcpy(&cur_input_display,joy,4);*/ }
//the main interaction point between the emulator and the movie system. //either dumps the current joystick state or loads one state from the movie static void FCEUMOV_AddInputState() { //todo - for tasedit, either dump or load depending on whether input recording is enabled //or something like that //(input recording is just like standard read+write movie recording with input taken from gamepad) //otherwise, it will come from the tasedit data. if(movieMode == MOVIEMODE_PLAY) { //stop when we run out of frames if(currFrameCounter == (int)currMovieData.records.size()) { StopPlayback(); } else { MovieRecord* mr = &currMovieData.records[currFrameCounter]; //reset if necessary if(mr->command_reset()) {} //ResetNES(); NDS_setPadFromMovie(mr->pad); } //if we are on the last frame, then pause the emulator if the player requested it if(currFrameCounter == (int)currMovieData.records.size()-1) { /*if(FCEUD_PauseAfterPlayback()) { FCEUI_ToggleEmulationPause(); }*/ } //pause the movie at a specified frame //if(FCEUMOV_ShouldPause() && FCEUI_EmulationPaused()==0) //{ // FCEUI_ToggleEmulationPause(); // FCEU_DispMessage("Paused at specified movie frame"); //} } else if(movieMode == MOVIEMODE_RECORD) { MovieRecord mr; mr.commands = 0; mr.pad = nds.pad; if(nds.isTouch) { mr.touch.x = nds.touchX; mr.touch.y = nds.touchY; mr.touch.touch = 1; } else { mr.touch.x = 0; mr.touch.y = 0; mr.touch.touch = 0; } mr.dump(&currMovieData, osRecordingMovie,currMovieData.records.size()); currMovieData.records.push_back(mr); } currFrameCounter++; /*extern uint8 joy[4]; memcpy(&cur_input_display,joy,4);*/ }