User:Elisherer

From WiiUBrew
Jump to navigation Jump to search

Hello everyone!

I'm a homebrew enthusiast.

  1. WiiBrew: Elisherer
  2. 3DBrew: Elisherer
  3. Open-source pojects: Google Code Project Hosting

http://www.sherer.co.il/

<wiki:toc />

Some file I made to help making apps to the Internet Browser:

wiiu.js

[Download]

This is a dummy object to be called in the <head> of the html file:

/*
 *	Wii U Dummy Object by elisherer
 *
 *
 */

wiiu = {};

wiiu.remote = {
	isEnabled: true,
	isDataValid: false,
	isCursorViewable: false,
	dpdX: 0,
	dpdY: 0,
	hold: 0,
	dpdRollX: 0,
	dpdRollY: 0,
	dpdDistance: 0,
	dpdValidity: 0,
	contentX: 0,
	contentY: 0,
	accX: 0,
	accY: 0,
	accZ: 0,
	mplsVelX: 0,
	mplsVelY: 0,
	mplsVelZ: 0,
	mplsAngX: 0,
	mplsAngY: 0,
	mplsAngZ: 0,
	mplsDirXx: 1.1,
	mplsDirXy: 0.0,
	mplsDirXz: 0.0,
	mplsDirYx: 0.0,
	mplsDirYy: 1.1,
	mplsDirYz: 0.0,
	mplsDirZx: 0.0,
	mplsDirZy: 0.0,
	mplsDirZz: 1.1,

	update: function (long_id) {
		if (this.isEnabled) {
			this.isDataValid = true;
			return this;
		}
		return null;
	},
	setCursorViewable: function(long_id, bool_viewable) {
		this.isCursorViewable = bool_viewable;
	}
};

wiiu.gamepad = {
	isEnabled: true,
	isDataValid: false,
	tpX: 0,
	tpY: 0,
	tpValidity: 0,
	tpTouch: 0,
	contentX: 0,
	contentY: 0,
	hold: 0,
	lStickX: 0,
	lStickY: 0,
	rStickX: 0,
	rStickY: 0,
	accX: 0,
	accY: 0,
	accZ: 0,
	gyroX: 0,
	gyroY: 0,
	gyroZ: 0,
	angleX: 0,
	angleY: 0,
	angleZ: 0,
	dirXx: 1.1,
	dirXy: 0.0,
	dirXz: 0.0,
	dirYx: 0.0,
	dirYy: 1.1,
	dirYz: 0.0,
	dirZx: 0.0,
	dirZy: 0.0,
	dirZz: 1.1,

	update: function() {
		if (this.isEnabled) {
			this.isDataValid = true;
			return this;
		}
		return null;
	}
};

wiiu.videoplayer = {
	viewMode: 0,
	end : function () { //invokes wiiu_videoplayer_end
		return true;
	}
};

wiiu.imageview = {
	viewMode: 0, //changing invokes wiiu_imageview_change_viewmode
	end : function () { //invokes wiiu_imageview_end
		return true;
	},
	getErrorCode: function () {
		return 0;
	}
};

wiiux.js

Download

This is a file of extra features, enums and helping functions:

/*
 *	Wii U eXtras by elisherer
 *
 */

wiiux = {
	gamepad: {},
	remote: {},
	videoplayer: {},
	imageview: {},
	status: {}
}

wiiux.gamepad.buttons = {
	
	//TBD:	0x00000001,
	HOME:	0x00000002,
	MINUS:	0x00000004,
	PLUS:	0x00000008,
	R:		0x00000010,
	L:		0x00000020,
	ZR:		0x00000040,
	ZL:		0x00000080,
	DOWN:	0x00000100,
	UP:		0x00000200,
	RIGHT:	0x00000400,
	LEFT:	0x00000800,
	Y:		0x00001000,
	X:		0x00002000,
	B:		0x00004000,
	A:		0x00008000,
	TV:		0x00010000,
	RCLICK:	0x00020000,
	LCLICK:	0x00040000,
	/*TBD:	0x00080000,
	TBD:	0x00100000,
	TBD:	0x00200000,
	TBD:	0x00400000,*/
	RDOWN:	0x00800000,
	RUP:	0x01000000,
	RRIGHT:	0x04000000,
	RLEFT:	0x02000000,
	LDOWN:	0x08000000,
	LUP:	0x10000000,
	LRIGHT:	0x20000000,
	LLEFT:	0x40000000,
	//TBD	0x80000000,

	isHeld: function (hold, button) {
		return (hold & 0x7f86fffc & button) ? 1: 0; //from Nintendo's sample
	}
};

wiiux.gamepad.keycodes = {
	A:		13,
	LEFT:	37,
	UP:		38,
	RIGHT:	39,
	DOWN:	40
};

wiiux.remote.buttons = {

	N1:		0x00000001,
	N2:		0x00000002,
	B:		0x00000004,
	A:		0x00000008,
	MINUS:	0x00000010,
	/*TBD:	0x00000020,
	TBD:	0x00000040,*/
	HOME:	0x00000080,
	LEFT:	0x00000100,
	RIGHT:	0x00000200,
	DOWN:	0x00000400,
	UP:		0x00000800,
	PLUS:	0x00001000,
	/*TBD:	0x00002000,
	TBD:	0x00004000,
	TBD:	0x00008000,
	TBD:	0x00010000,
	TBD:	0x00020000,
	TBD:	0x00040000,
	TBD:	0x00080000,
	TBD:	0x00100000,
	TBD:	0x00200000,
	TBD:	0x00400000,
	TBD:	0x00800000,
	TBD:	0x01000000,
	TBD:	0x04000000,
	TBD:	0x02000000,
	TBD:	0x08000000,
	TBD:	0x10000000,
	TBD:	0x20000000,
	TBD:	0x40000000*/
};

/*
 * Usage: document.addEventListener(wiiux.imageview.events.onend, myFuncOnEnd, false);
 */
wiiux.imageview.events = {
	onstart: "wiiu_imageview_start", //function()
	onend: "wiiu_imageview_end", //function()
	onviewmodechanged: "wiiu_imageview_change_viewmode", //function(mode)
	oncontentchanged: "wiiu_imageview_change_content", //function()
	onerror: "wiiu_imageview_error" //function()
}

wiiux.imageview.errorCodes = {
	"-1" :	"No error",
	"202":	"Unsupported image format",
	"203":	"Image dimensions too large",
	"204":	"File size too large",
	"205":	"Too many pixels in progressive-mode JPEG"
}

/*
 * Usage: htmlVideoElement.addEventListener(wiiux.videoplayer.events.onend, myFuncOnEnd, false);
 */
wiiux.videoplayer.events = {
	onend: "wiiu_videoplayer_end" //function()
}


wiiux.update = function () {
	var gamepad;
	if (window.wiiu) {
		wiiux.status.remote = window.wiiu.remote.update();
		wiiux.status.gamepad = window.wiiu.gamepad.update();
	}
}

wiiux.autoUpdate = function () {
	setInterval('wiiux.update()', 20);
}