Giter Club home page Giter Club logo

Comments (5)

BinBashBanana avatar BinBashBanana commented on May 31, 2024

That seems like a good idea to implement in the future! Should I have the screenshot immediately downloaded? Or did you have something else in mind?

from webretro.

dimabubenok avatar dimabubenok commented on May 31, 2024

I am trying to implement saving game state with screenshot display. When i try to read a file in the virtual file system along the path /home/web_user/retroarch/userdata/screenshots/rom-210621-190311.png, an error occurs.

from webretro.

BinBashBanana avatar BinBashBanana commented on May 31, 2024

You may have to put it on a short setTimeout.

from webretro.

dimabubenok avatar dimabubenok commented on May 31, 2024

I did save screenshot to file:

function takeScreenshot(){
	Module._cmd_take_screenshot();
	var screenshot_path = "/home/web_user/retroarch/userdata/screenshots/";
	var screenshot_name = makeScreenshotFilename();

	window.setTimeout(function() {
		if(FS.analyzePath(screenshot_path+screenshot_name).exists) {
			var file = FS.readFile(screenshot_path+screenshot_name);
			downloadFile(file,screenshot_name);
		} else {
			console.log('screenshot not found')
		}
	}, 500);
}

function makeScreenshotFilename(){
	var now = new Date();
	var y = now.getFullYear().toString().slice(-2),
		m = ("0" + (now.getMonth() + 1)).slice(-2),
		d = ("0" + now.getDate()).slice(-2),
		h = ("0" + now.getHours()).slice(-2),
		i = ("0" + now.getMinutes()).slice(-2),
		s = ("0" + now.getSeconds()).slice(-2);

	return `rom-${y}${m}${d}-${h}${i}${s}.png`;
}

from webretro.

BinBashBanana avatar BinBashBanana commented on May 31, 2024

Nice! That works very well! I was planning on making a screenshot gallery feature, so that the user could browse their screenshots, and then download them whenever they want. Will be in the next update.

from webretro.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.