WeiWeiXinNet/Games/game3/js/GameBoyIO.js

(开头部分) 6KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

var gameboy = null;						//GameBoyCore object.
var gbRunInterval;						//GameBoyCore Timer
var settings = [						//Some settings.
	false, 								//Turn on sound.
	false,								//Force Mono sound.
	false,								//Give priority to GameBoy mode
	[39, 37, 38, 40, 88, 90, 16, 13],	//Keyboard button map.
	0,									//Frameskip Amount (Auto frameskip setting allows the script to change this.)
	false,								//Use the data URI BMP method over the canvas tag method?
	[16, 12],							//How many tiles in each direction when using the BMP method (width * height).
	true,								//Auto Frame Skip
	29,									//Maximum Frame Skip
	true,								//Override to allow for MBC1 instead of ROM only (compatibility for broken 3rd-party cartridges).
	true,								//Override MBC RAM disabling and always allow reading and writing to the banks.
	20,									//Audio granularity setting (Sampling of audio every x many machine cycles)
	10,									//Frameskip base factor
	17826,								//Target number of machine cycles per loop. (4,194,300 / 1000 * 17)
	70000,								//Sample Rate
	0x10,								//How many bits per WAV PCM sample (For browsers that fall back to WAV PCM generation)
	false,								//Use the GBC BIOS?
	false,								//Colorize GB mode?
	512,								//Sample size for webkit audio.
	false,								//Whether to display the canvas at 144x160 on fullscreen or as stretched.
	17,									//Interval for the emulator loop.
	false,								//Render nearest-neighbor scaling in javascript?
	false								//Disallow typed arrays?
];
function start(canvas, canvasAlt, ROM) {
	clearLastEmulation();
	gameboy = new GameBoyCore(canvas, canvasAlt, ROM);
	gameboy.start();
	run();
}
function continueCPU() {
	gameboy.run();
}
function run() {
	if (typeof gameboy == "object" && gameboy != null && (gameboy.stopEmulator & 2) == 2) {
		gameboy.stopEmulator &= 1;
		gameboy.lastIteration = new Date().getTime();
		cout("Starting the iterator.", 0);
		gbRunInterval = setInterval(continueCPU, settings[20]);
	}
	else if ((gameboy.stopEmulator & 2) == 0) {
		cout("The GameBoy core is already running.", 1);
	}
	else {
		cout("GameBoy core cannot run while it has not been initialized.", 1);
	}
}
function pause() {
	if (typeof gameboy == "object" && gameboy != null && (gameboy.stopEmulator & 2) == 0) {
		clearLastEmulation();
	}
	else if ((gameboy.stopEmulator & 2) == 2) {
		cout("GameBoy core has already been paused.", 1);
	}
	else {
		cout("GameBoy core cannot be paused while it has not been initialized.", 1);
	}
后面还有 157 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。