Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.
The main server is currently down. We are running on a backup server, so editing and search functionality are temporarily disabled. Please check back in a few hours.

Module:Infobox WiiU Homebrews: Difference between revisions

From GameBrew
No edit summary
No edit summary
Line 51: Line 51:
end
end
   
   
local function getType( type )
local function getType(typeVal)
if empty( type ) then return end
    if not typeVal then return end
 
local types = {
    local categories = {
-- Applications
        -- Applications (Exploits, Homebrew Forwarders, Payload
['media player']       = '[[List of Wii U homebrew applications#Media players|Media player]] [[Category:Wii U Homebrew media players]]',
        ['Backup Tools']         = {'WiiU homebrew applications', 'Backup tools on Wii U', 'Wii U homebrew applications'},
['utility']           = '[[List of Wii U homebrew applications#Utilities|Utility]] [[Category:Wii U Homebrew utilities]]',
        ['Custom Firmwares']     = {'WiiU homebrew applications', 'Custom firmwares on Wii U', 'Wii U homebrew applications'},
['operating system']   = '[[List of Wii U homebrew applications#Operating systems|Operating system]] [[Category:Wii U Homebrew operating systems]]',
        ['File Browsers']       = {'WiiU homebrew applications', 'File browsers on Wii U', 'Wii U homebrew applications'},
['math']               = '[[List of Wii U homebrew applications#Math|Math application]] [[Category:Wii U Homebrew math applications]]',
        ['Other Apps']           = {'WiiU homebrew applications', 'Other applications on Wii U', 'Wii U homebrew applications'},
['other']             = '[[List of Wii U homebrew applications#Other applications|Other application]] [[Category:Wii U Homebrew other applications]]',
        ['Music Apps']           = {'WiiU homebrew applications', 'Music applications on Wii U', 'Wii U homebrew applications'},
-- Games
        ['System Tools']         = {'WiiU homebrew applications', 'System tools on Wii U', 'Wii U homebrew applications'},
['arcade game']       = '[[List of Wii U homebrew games#Arcade|Arcade game]] [[Category:Wii U Homebrew arcade games]]',
        ['Title Launchers']     = {'WiiU homebrew applications', 'Title launchers on Wii U', 'Wii U homebrew applications'},
['board game']        = '[[List of Wii U homebrew games#Board|Board game]] [[Category:Wii U Homebrew board games]]',
        ['Utilities']           = {'WiiU homebrew applications', 'Utility applications on Wii U', 'Wii U homebrew applications'},
['card game']         = '[[List of Wii U homebrew games#Card|Card game]] [[Category:Wii U Homebrew card games]]',
        -- Games
['game engine']       = '[[List of Wii U homebrew games#Game engine|Game engine]] [[Category:Wii U Homebrew game engines]]',
        ['Action']               = {'WiiU homebrew games', 'Action games on Wii U', 'Wii U homebrew games'},
['music game']         = '[[List of Wii U homebrew games#Music|Music game]] [[Category:Wii U Homebrew music games]]',
        ['Adventure']           = {'WiiU homebrew games', 'Adventure games on Wii U', 'Wii U homebrew games'},
['platform game']     = '[[List of Wii U homebrew games#Platform|Platform game]] [[Category:Wii U Homebrew platform games]]',
        ['Arcade Games']        = {'WiiU homebrew games', 'Arcade games on Wii U', 'Wii U homebrew games'},
['puzzle game']       = '[[List of Wii U homebrew games#Puzzle|Puzzle game]] [[Category:Wii U Homebrew puzzle games]]',
        ['Board']                = {'WiiU homebrew games', 'Board games on Wii U', 'Wii U homebrew games'},
['racing game']       = '[[List of Wii U homebrew games#Racing|Racing game]] [[Category:Wii U Homebrew racing games]]',
        ['Card']                 = {'WiiU homebrew games', 'Card games on Wii U', 'Wii U homebrew games'},
['role playing game'] = '[[List of Wii U homebrew games#Role playing|Role playing game]] [[Category:Wii U Homebrew role playing games]]',
        ['Music']               = {'WiiU homebrew games', 'Music games on Wii U', 'Wii U homebrew games'},
['shooting game']     = '[[List of Wii U homebrew games#Shooter|Shooting game]] [[Category:Wii U Homebrew shooting games]]',
        ['Other Games']         = {'WiiU homebrew games', 'Other games on Wii U', 'Wii U homebrew games'},
['simulation game']   = '[[List of Wii U homebrew games#Simulation|Simulation game]] [[Category:Wii U Homebrew simulation games]]',
        ['Platform']             = {'WiiU homebrew games', 'Platform games on Wii U', 'Wii U homebrew games'},
['trivia game']       = '[[List of Wii U homebrew games#Trivia|Trivia game]] [[Category:Wii U Homebrew trivia games]]',
        ['Puzzle']               = {'WiiU homebrew games', 'Puzzle games on Wii U', 'Wii U homebrew games'},
['other game']         = '[[List of Wii U homebrew games#Other games|Other game]] [[Category:Wii U Homebrew other games]]',
        ['Racing']               = {'WiiU homebrew games', 'Racing games on Wii U', 'Wii U homebrew games'},
-- Emulators
        ['Role Playing']         = {'WiiU homebrew games', 'Role playing games on Wii U', 'Wii U homebrew games'},
['console emulator']   = '[[List of Wii U homebrew emulators#Console|Console emulator]] [[Category:Wii U Homebrew console emulators]]',
        ['Shooter']             = {'WiiU homebrew games', 'Shooter games on Wii U', 'Wii U homebrew games'},
['handheld emulator'] = '[[List of Wii U homebrew emulators#Handheld|Handheld emulator]] [[Category:Wii U Homebrew portable emulators]]',
        ['Simulation']           = {'WiiU homebrew games', 'Simulation games on Wii U', 'Wii U homebrew games'},
['arcade emulator']   = '[[List of Wii U homebrew emulators#Arcade|Arcade emulator]] [[Category:Wii U Homebrew arcade emulators]]',
        ['Strategy']             = {'WiiU homebrew games', 'Strategy games on Wii U', 'Wii U homebrew games'},
['computer emulator'] = '[[List of Wii U homebrew emulators#Computer|Computer emulator]] [[Category:Wii U Homebrew computer emulators]]',
        ['Trivia']               = {'WiiU homebrew games', 'Trivia games on Wii U', 'Wii U homebrew games'},
-- Loaders
        -- Emulators
['loader']             = '[[List of Wii U homebrew loaders|Loader]] [[Category:Wii U Homebrew loaders]]',
        ['Computer']             = {'WiiU homebrew emulators', 'Computer emulators on Wii U', 'Wii U homebrew emulators'},
-- Exploits
        ['Console']              = {'WiiU homebrew emulators', 'Console emulators on Wii U', 'Wii U homebrew emulators'},
['exploit']           = '[[List of Wii U homebrew exploits|Exploit]] [[Category:Wii U Homebrew exploits]]',
        ['Handheld']             = {'WiiU homebrew emulators', 'Handheld emulators on Wii U', 'Wii U homebrew emulators'},
-- System Tools
        ['Other Emulators']     = {'WiiU homebrew emulators', 'Other emulators on Wii U', 'Wii U homebrew emulators'},
['system tool']       = '[[List of Wii U system tools|System tool]] [[Category:Wii U homebrew system tools]]',
        -- PC (PC Utilities for WiiU)
-- PC Utilities
        ['Controller Mapping']   = {'WiiU PC utilities', 'Controller mapping programs for Wii U', 'PC utilities for Wii U'},
['pc utility']        = '[[List of Wii U PC utilities|PC utility]] [[Category:Wii U PC utilities]]',
        ['Development']         = {'WiiU PC utilities', 'Development utilities for Wii U', 'PC utilities for Wii U'},
-- Demos
        ['File Operation']      = {'WiiU PC utilities', 'File management utilities for Wii U', 'PC utilities for Wii U'},
['demo']               = '[[List of Wii U homebrew demos|Demo]] [[Category:Wii U homebrew demos]]',
        ['Network Tools']        = {'WiiU PC utilities', 'Network tools for Wii U', 'PC utilities for Wii U'},
}
        ['Game Injection']       = {'WiiU PC utilities', 'Game injectors for Wii U', 'PC utilities for Wii U'},
        ['PC Utilities']         = {'WiiU PC utilities', 'Other PC utilities for Wii U', 'PC utilities for Wii U'},
return types[type] or type .. '[[Category:Infobox homebrew using invalid type parameter]]'
        -- Demos
        ['Demos']               = {'WiiU homebrew demos', 'Demo homebrews on Wii U', 'Wii U homebrew applications'},
        -- Plugins
        ['Plugins']             = {'WiiU plugins', 'Wii U plugins', 'Wii U homebrew applications'},
        -- ROM Hack
        ['Game Hacks']           = {'all WiiU Rom Hacks', 'Wii U game hacks', 'Wii U rom hacks'},
         ['Game Trainers']        = {'all WiiU Rom Hacks', 'Wii U game trainers', 'Wii U rom hacks'},
        ['Hack Utilities']      = {'all WiiU Rom Hacks', 'Wii U hack utilities', 'Wii U rom hacks'},
    }
 
    local category = categories[typeVal]
    if category then
            return string.format('[[List of %s#%s|%s]] [[Category:%s]] [[Category:%s]]', category[1], typeVal, typeVal, category[2], category[3])
    else
        return typeVal .. '[[Category:Infobox homebrew using invalid type parameter]]'
    end
end
end
   
   
Line 146: Line 161:
local function getSource( source )
local function getSource( source )
if empty( source ) then return end
if empty( source ) then return end
if source == 'included' then return 'Source included[[Category:Wii U Open Source Homebrew]]' end
if source == 'included' then return 'Source included[[Category:Wii U open source homebrew]]' end
   
   
return getLink( 'Source', source ) .. '[[Category:Wii U Open Source Homebrew]]'
return getLink( 'Source', source ) .. '[[Category:Wii U open source homebrew]]'
end
end



Revision as of 07:00, 6 July 2024

Documentation for this module may be created at Module:Infobox WiiU Homebrews/doc

local p = {}

local function div()
local div = mw.html.create( 'div' )
div
	:attr( 'id', 'Ads-Infobox' )
return tostring( div )
end

local function div2()
local div = mw.html.create( 'div' )
div
	:attr( 'id', 'largemobilebanner' )
return tostring( div )
end

local function div3()
local div = mw.html.create( 'div' )
div
	:attr( 'id', 'Ads-Infobox1' )
return tostring( div )
end

local function div4()
local div = mw.html.create( 'div' )
div
	:attr( 'id', 'Ads-Infobox3' )
return tostring( div )
end
 
local function empty(param)
	return not param or param == ''	
end

local function formatUser( user )
	return '[[User:' .. user .. (user:find('|') and '' or ('|' .. user)) .. ']]'
end
 
local function userList( list )
	if empty(list) then return end
 
	if not list:find(',') then
		return formatUser(list)	
	end
 
	local ret = {}
	for user in mw.text.gsplit( list, '%s*,%s*' ) do
		ret[#ret+1] = formatUser(user)	
	end
	return table.concat( ret, ', ' )
end
 
local function getType(typeVal)
    if not typeVal then return end

    local categories = {
        -- Applications (Exploits, Homebrew Forwarders, Payload
        ['Backup Tools']         = {'WiiU homebrew applications', 'Backup tools on Wii U', 'Wii U homebrew applications'},
        ['Custom Firmwares']     = {'WiiU homebrew applications', 'Custom firmwares on Wii U', 'Wii U homebrew applications'},
        ['File Browsers']        = {'WiiU homebrew applications', 'File browsers on Wii U', 'Wii U homebrew applications'},
        ['Other Apps']           = {'WiiU homebrew applications', 'Other applications on Wii U', 'Wii U homebrew applications'},
        ['Music Apps']           = {'WiiU homebrew applications', 'Music applications on Wii U', 'Wii U homebrew applications'},
        ['System Tools']         = {'WiiU homebrew applications', 'System tools on Wii U', 'Wii U homebrew applications'},
        ['Title Launchers']      = {'WiiU homebrew applications', 'Title launchers on Wii U', 'Wii U homebrew applications'},
        ['Utilities']            = {'WiiU homebrew applications', 'Utility applications on Wii U', 'Wii U homebrew applications'},
        -- Games
        ['Action']               = {'WiiU homebrew games', 'Action games on Wii U', 'Wii U homebrew games'},
        ['Adventure']            = {'WiiU homebrew games', 'Adventure games on Wii U', 'Wii U homebrew games'},
        ['Arcade Games']         = {'WiiU homebrew games', 'Arcade games on Wii U', 'Wii U homebrew games'},
        ['Board']                = {'WiiU homebrew games', 'Board games on Wii U', 'Wii U homebrew games'},		
        ['Card']                 = {'WiiU homebrew games', 'Card games on Wii U', 'Wii U homebrew games'},	
        ['Music']                = {'WiiU homebrew games', 'Music games on Wii U', 'Wii U homebrew games'},	
        ['Other Games']          = {'WiiU homebrew games', 'Other games on Wii U', 'Wii U homebrew games'},	
        ['Platform']             = {'WiiU homebrew games', 'Platform games on Wii U', 'Wii U homebrew games'},	
        ['Puzzle']               = {'WiiU homebrew games', 'Puzzle games on Wii U', 'Wii U homebrew games'},	
        ['Racing']               = {'WiiU homebrew games', 'Racing games on Wii U', 'Wii U homebrew games'},	
        ['Role Playing']         = {'WiiU homebrew games', 'Role playing games on Wii U', 'Wii U homebrew games'},	
        ['Shooter']              = {'WiiU homebrew games', 'Shooter games on Wii U', 'Wii U homebrew games'},	
        ['Simulation']           = {'WiiU homebrew games', 'Simulation games on Wii U', 'Wii U homebrew games'},	
        ['Strategy']             = {'WiiU homebrew games', 'Strategy games on Wii U', 'Wii U homebrew games'},	
        ['Trivia']               = {'WiiU homebrew games', 'Trivia games on Wii U', 'Wii U homebrew games'},	
        -- Emulators
        ['Computer']             = {'WiiU homebrew emulators', 'Computer emulators on Wii U', 'Wii U homebrew emulators'},
        ['Console']              = {'WiiU homebrew emulators', 'Console emulators on Wii U', 'Wii U homebrew emulators'},
        ['Handheld']             = {'WiiU homebrew emulators', 'Handheld emulators on Wii U', 'Wii U homebrew emulators'},
        ['Other Emulators']      = {'WiiU homebrew emulators', 'Other emulators on Wii U', 'Wii U homebrew emulators'},
        -- PC (PC Utilities for WiiU)
        ['Controller Mapping']   = {'WiiU PC utilities', 'Controller mapping programs for Wii U', 'PC utilities for Wii U'},
        ['Development']          = {'WiiU PC utilities', 'Development utilities for Wii U', 'PC utilities for Wii U'},
        ['File Operation']       = {'WiiU PC utilities', 'File management utilities for Wii U', 'PC utilities for Wii U'},
        ['Network Tools']        = {'WiiU PC utilities', 'Network tools for Wii U', 'PC utilities for Wii U'},
        ['Game Injection']       = {'WiiU PC utilities', 'Game injectors for Wii U', 'PC utilities for Wii U'},
        ['PC Utilities']         = {'WiiU PC utilities', 'Other PC utilities for Wii U', 'PC utilities for Wii U'},
        -- Demos
        ['Demos']                = {'WiiU homebrew demos', 'Demo homebrews on Wii U', 'Wii U homebrew applications'},
        -- Plugins
        ['Plugins']              = {'WiiU plugins', 'Wii U plugins', 'Wii U homebrew applications'},
        -- ROM Hack
        ['Game Hacks']           = {'all WiiU Rom Hacks', 'Wii U game hacks', 'Wii U rom hacks'},
        ['Game Trainers']        = {'all WiiU Rom Hacks', 'Wii U game trainers', 'Wii U rom hacks'},
        ['Hack Utilities']       = {'all WiiU Rom Hacks', 'Wii U hack utilities', 'Wii U rom hacks'},
    }

    local category = categories[typeVal]
    if category then
            return string.format('[[List of %s#%s|%s]] [[Category:%s]] [[Category:%s]]', category[1], typeVal, typeVal, category[2], category[3])
    else
        return typeVal .. '[[Category:Infobox homebrew using invalid type parameter]]'
    end
end
 
local function getLicense( license )
	if empty( license ) then return end
 
	local licenses = {
		['Apache']       = '[https://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0]',
		['GNU GPL']      = '[https://www.gnu.org/licenses/gpl.html GNU GPL]',
		['GNU LGPL']     = '[https://www.gnu.org/licenses/lgpl.html GNU LGPL]',
		['BSD 2-Clause'] = '[http://opensource.org/licenses/BSD-2-Clause BSD 2-Clause]',
		['BSD 3-Clause'] = '[http://opensource.org/licenses/BSD-3-Clause BSD 3-Clause]',
		['Mixed']        = 'Mixed',
		['MIT']          = '[http://opensource.org/licenses/mit-license.html MIT License]',
	}
 
	return licenses[license] or license
end
 
local function getFormats( a )
	local formats = { 'Wii Ux', 'Wii U', 'cia', 'bin', 'dat', 'cxi' }
	local ret = {}
 
	for i=1,#formats do
		local f = formats[i]
		local tmp = a[f]
		if not empty(tmp) then
			local label = f == 'bin' and 'bin/elf' or f
			if tmp == 'yes' then
				ret[#ret+1] = label .. ' <span style="color:#00B000">✔</span>'
			elseif tmp == 'no' then
				ret[#ret+1] = label .. ' <span style="color:red">✘</span>'
			else
				ret[#ret+1] = label .. ' <span style="color:orange">?</span>'
			end
		end
	end
 
	if next(ret) == nil then return end -- We got nothing...
	return table.concat(ret, '<br />')
end
 
local function getLink( label, link, altlink )
	if empty( link ) then return altlink end
 
	if link:find( '://' ) then
		return '[' .. link .. ' ' .. label .. ']'	
	end
 
	return '[[' .. link .. '|' .. label .. ']]'
end
 
local function getSource( source )
	if empty( source ) then return end
	if source == 'included' then return 'Source included[[Category:Wii U open source homebrew]]' end
 
	return getLink( 'Source', source ) .. '[[Category:Wii U open source homebrew]]'
end

local function getDonation( donation )
	if empty( donation ) then return end
	if donation == 'included' then return 'Donation included[[Category:Support the author]]' end
 
	return getLink( 'Support Author', donation ) .. '[[Category:Support the author]]'
end
 
local function getDownloadMii( dm, dmversion, version )
	if not dm or dm ~= 'yes' then return end
 
	if empty(dmversion) or dmversion == version then
		return 'Downloadable via [[DownloadMii]] [[Category:Wii U Homebrew in DownloadMii]]'
	else
		return "Version '''" .. dmversion .. "''' downloadable via [[DownloadMii]] [[Category:Wii U Homebrew in DownloadMii]]"
	end
end
 
function p.main( frame )
	local a = frame:getParent().args
	local infobox = require( 'Module:Infobox' )
 
	if not empty( a.title ) then
		frame:callParserFunction( 'DISPLAYTITLE', a.title )	
	end
 
	local ibData = {
		title    = a.title,
		image    = a.image,
		imagesize    = a.imagesize or '48px',
		imagecaption = a.imagecaption,
		header3  = 'General',
		label4   = 'Author',
		data4    = a.author,
		label5   = 'Contributor',
		data5    = userList( a.contributor ),
		label6   = 'Ported by',
		data6    = userList( a.portedby ),
		label7   = 'Type',
		data7    = getType( a['type'] ),
		label8   = 'Version',
		data8    = a.version,
		label9   = 'License',
		data9    = getLicense( a.license ),
		label10   = 'Language',
		data10    = a.language,
		label11  = 'Format',
		data11   = getFormats( a ),
		label12   = 'Last Updated',
		data12    = a.lastupdated,
        header13 = div3(),
        header20 = div(),
        header2 = div2(),
		-- Links
		data15   = getLink( 'Download', a.download, a.downloadraw ),
		data16   = getLink( 'Website', a.website ),
		data17   = getSource( a.source ),
		data18   = getDonation( a.donation),
		data19   = getDownloadMii( a.dm, a.dmversion, a.version ),
		below    = a.below
	}
 
	if ibData.data15 or ibData.data16 or ibData.data17 or ibData.data18 or ibData.data19 then ibData.header14 = 'Links' end
 
	if a.cia == 'yes' then
		ibData.header111 = 'CIA information'
		ibData.label112  = 'Title ID'
		ibData.data112   = a.titleID or 'Unknown[[Category:Wii U Homebrew missing CIA titleID]]'
		ibData.label113  = 'Unique ID'
		ibData.data113   = a.uniqueID or 'Unknown[[Category:Wii U Homebrew missing CIA uniqueID]]'
	end
 
	return infobox.infobox( ibData )
end
 
return p

Advertising: