extern "C" void TakeScreenshot(int iFrameNumber) { char *filename; // look for an unused screenshot filename filename = GetNextScreenshotPath(); if (filename == NULL) return; // get the width and height int width = 640; int height = 480; gfx.readScreen(NULL, &width, &height, 0); // allocate memory for the image unsigned char *pucFrame = (unsigned char *) malloc(width * height * 3); if (pucFrame == NULL) { free(filename); return; } // grab the back image from OpenGL by calling the video plugin gfx.readScreen(pucFrame, &width, &height, 0); // write the image to a PNG SaveRGBBufferToFile(filename, pucFrame, width, height, width * 3); // free the memory free(pucFrame); free(filename); // print message -- this allows developers to capture frames and use them in the regression test main_message(M64MSG_INFO, OSD_BOTTOM_LEFT, "Captured screenshot for frame %i.", iFrameNumber); }
void main_speedup(int percent) { if (l_SpeedFactor + percent < 300) /* 300% maximum speed */ { l_SpeedFactor += percent; main_message(M64MSG_STATUS, OSD_BOTTOM_LEFT, "%s %d%%", "Playback speed:", l_SpeedFactor); setSpeedFactor(l_SpeedFactor); // call to audio plugin StateChanged(M64CORE_SPEED_FACTOR, l_SpeedFactor); } }
extern "C" void TakeScreenshot(int iFrameNumber) { char filepath[PATH_MAX], filename[PATH_MAX]; // get screenshot directory and base filename (based on ROM header) GetBaseFilepath(filepath, PATH_MAX - 10); // look for an unused screenshot filename for (; CurrentShotIndex < 1000; CurrentShotIndex++) { sprintf(filename, "%s-%03i.png", filepath, CurrentShotIndex); FILE *pFile = fopen(filename, "r"); if (pFile == NULL) break; fclose(pFile); } if (CurrentShotIndex >= 1000) { DebugMessage(M64MSG_ERROR, "Can't save screenshot; folder already contains 1000 screenshots for this ROM"); return; } CurrentShotIndex++; // get the width and height int width = 640; int height = 480; readScreen(NULL, &width, &height, 0); // allocate memory for the image unsigned char *pucFrame = (unsigned char *) malloc(width * height * 3); if (pucFrame == 0) return; // grab the back image from OpenGL by calling the video plugin readScreen(pucFrame, &width, &height, 0); // write the image to a PNG SaveRGBBufferToFile(filename, pucFrame, width, height, width * 3); // free the memory free(pucFrame); // print message -- this allows developers to capture frames and use them in the regression test main_message(M64MSG_INFO, OSD_BOTTOM_LEFT, "Captured screenshot for frame %i.", iFrameNumber); }
int main(int argc, char* argv[]) { char* bn = basename(argv[0]); if (strcmp(bn, "chmon")==0) { return main_chmon(argc, argv); } else if (strcmp(bn, "message")==0) { return main_message(argc, argv); } else if (strcmp(bn, "therm")==0) { return main_therm(argc, argv); } printf("Unknown applet\n"); return -1; }