More actions
(Created page with "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' ) re...") |
No edit summary |
||
Line 56: | Line 56: | ||
local types = { | local types = { | ||
-- Applications | -- Applications | ||
['media player'] = '[[List of | ['media player'] = '[[List of PS4 homebrew applications#Media players|Media player]] [[Category:PS4 Homebrew media players]]', | ||
['utility'] = '[[List of | ['utility'] = '[[List of PS4 homebrew applications#Utilities|Utility]] [[Category:PS4 Homebrew utilities]]', | ||
['operating system'] = '[[List of | ['operating system'] = '[[List of PS4 homebrew applications#Operating systems|Operating system]] [[Category:PS4 Homebrew operating systems]]', | ||
['math'] = '[[List of | ['math'] = '[[List of PS4 homebrew applications#Math|Math application]] [[Category:PS4 Homebrew math applications]]', | ||
['other'] = '[[List of | ['other'] = '[[List of PS4 homebrew applications#Other applications|Other application]] [[Category:PS4 Homebrew other applications]]', | ||
-- Games | -- Games | ||
['arcade game'] = '[[List of | ['arcade game'] = '[[List of PS4 homebrew games#Arcade|Arcade game]] [[Category:PS4 Homebrew arcade games]]', | ||
['board game'] = '[[List of | ['board game'] = '[[List of PS4 homebrew games#Board|Board game]] [[Category:PS4 Homebrew board games]]', | ||
['card game'] = '[[List of | ['card game'] = '[[List of PS4 homebrew games#Card|Card game]] [[Category:PS4 Homebrew card games]]', | ||
['game engine'] = '[[List of | ['game engine'] = '[[List of PS4 homebrew games#Game engine|Game engine]] [[Category:PS4 Homebrew game engines]]', | ||
['music game'] = '[[List of | ['music game'] = '[[List of PS4 homebrew games#Music|Music game]] [[Category:PS4 Homebrew music games]]', | ||
['platform game'] = '[[List of | ['platform game'] = '[[List of PS4 homebrew games#Platform|Platform game]] [[Category:PS4 Homebrew platform games]]', | ||
['puzzle game'] = '[[List of | ['puzzle game'] = '[[List of PS4 homebrew games#Puzzle|Puzzle game]] [[Category:PS4 Homebrew puzzle games]]', | ||
['racing game'] = '[[List of | ['racing game'] = '[[List of PS4 homebrew games#Racing|Racing game]] [[Category:PS4 Homebrew racing games]]', | ||
['role playing game'] = '[[List of | ['role playing game'] = '[[List of PS4 homebrew games#Role playing|Role playing game]] [[Category:PS4 Homebrew role playing games]]', | ||
['shooting game'] = '[[List of | ['shooting game'] = '[[List of PS4 homebrew games#Shooter|Shooting game]] [[Category:PS4 Homebrew shooting games]]', | ||
['simulation game'] = '[[List of | ['simulation game'] = '[[List of PS4 homebrew games#Simulation|Simulation game]] [[Category:PS4 Homebrew simulation games]]', | ||
['trivia game'] = '[[List of | ['trivia game'] = '[[List of PS4 homebrew games#Trivia|Trivia game]] [[Category:PS4 Homebrew trivia games]]', | ||
['other game'] = '[[List of | ['other game'] = '[[List of PS4 homebrew games#Other games|Other game]] [[Category:PS4 Homebrew other games]]', | ||
-- Emulators | -- Emulators | ||
['console emulator'] = '[[List of | ['console emulator'] = '[[List of PS4 homebrew emulators#Console|Console emulator]] [[Category:PS4 Homebrew console emulators]]', | ||
['handheld emulator'] = '[[List of | ['handheld emulator'] = '[[List of PS4 homebrew emulators#Handheld|Handheld emulator]] [[Category:PS4 Homebrew portable emulators]]', | ||
['arcade emulator'] = '[[List of | ['arcade emulator'] = '[[List of PS4 homebrew emulators#Arcade|Arcade emulator]] [[Category:PS4 Homebrew arcade emulators]]', | ||
['computer emulator'] = '[[List of | ['computer emulator'] = '[[List of PS4 homebrew emulators#Computer|Computer emulator]] [[Category:PS4 Homebrew computer emulators]]', | ||
-- Loaders | -- Loaders | ||
['loader'] = '[[List of | ['loader'] = '[[List of PS4 homebrew loaders|Loader]] [[Category:PS4 Homebrew loaders]]', | ||
-- Exploits | -- Exploits | ||
['exploit'] = '[[List of | ['exploit'] = '[[List of PS4 homebrew exploits|Exploit]] [[Category:PS4 Homebrew exploits]]', | ||
-- System Tools | -- System Tools | ||
['system tool'] = '[[List of | ['system tool'] = '[[List of PS4 system tools|System tool]] [[Category:PS4 homebrew system tools]]', | ||
-- PC Utilities | -- PC Utilities | ||
['pc utility'] = '[[List of | ['pc utility'] = '[[List of PS4 PC utilities|PC utility]] [[Category:PS4 PC utilities]]', | ||
-- Demos | -- Demos | ||
['demo'] = '[[List of | ['demo'] = '[[List of PS4 homebrew demos|Demo]] [[Category:PS4 homebrew demos]]', | ||
} | } | ||
Line 112: | Line 112: | ||
local function getFormats( a ) | local function getFormats( a ) | ||
local formats = { ' | local formats = { 'PS4x', 'PS4', 'cia', 'bin', 'dat', 'cxi' } | ||
local ret = {} | local ret = {} | ||
Line 146: | Line 146: | ||
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: | if source == 'included' then return 'Source included[[Category:PS4 open source homebrew]]' end | ||
return getLink( 'Source', source ) .. '[[Category: | return getLink( 'Source', source ) .. '[[Category:PS4 open source homebrew]]' | ||
end | end | ||
Line 162: | Line 162: | ||
if empty(dmversion) or dmversion == version then | if empty(dmversion) or dmversion == version then | ||
return 'Downloadable via [[DownloadMii]] [[Category: | return 'Downloadable via [[DownloadMii]] [[Category:PS4 Homebrew in DownloadMii]]' | ||
else | else | ||
return "Version '''" .. dmversion .. "''' downloadable via [[DownloadMii]] [[Category: | return "Version '''" .. dmversion .. "''' downloadable via [[DownloadMii]] [[Category:PS4 Homebrew in DownloadMii]]" | ||
end | end | ||
end | end | ||
Line 202: | Line 202: | ||
header13 = div3(), | header13 = div3(), | ||
header20 = div(), | header20 = div(), | ||
header2 = div2(), | |||
-- Links | -- Links | ||
data15 = getLink( 'Download', a.download, a.downloadraw ), | data15 = getLink( 'Download', a.download, a.downloadraw ), | ||
Line 217: | Line 217: | ||
ibData.header111 = 'CIA information' | ibData.header111 = 'CIA information' | ||
ibData.label112 = 'Title ID' | ibData.label112 = 'Title ID' | ||
ibData.data112 = a.titleID or 'Unknown[[Category: | ibData.data112 = a.titleID or 'Unknown[[Category:PS4 Homebrew missing CIA titleID]]' | ||
ibData.label113 = 'Unique ID' | ibData.label113 = 'Unique ID' | ||
ibData.data113 = a.uniqueID or 'Unknown[[Category: | ibData.data113 = a.uniqueID or 'Unknown[[Category:PS4 Homebrew missing CIA uniqueID]]' | ||
end | end | ||
Latest revision as of 00:52, 17 April 2024
Documentation for this module may be created at Module:Infobox PS4 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( type ) if empty( type ) then return end local types = { -- Applications ['media player'] = '[[List of PS4 homebrew applications#Media players|Media player]] [[Category:PS4 Homebrew media players]]', ['utility'] = '[[List of PS4 homebrew applications#Utilities|Utility]] [[Category:PS4 Homebrew utilities]]', ['operating system'] = '[[List of PS4 homebrew applications#Operating systems|Operating system]] [[Category:PS4 Homebrew operating systems]]', ['math'] = '[[List of PS4 homebrew applications#Math|Math application]] [[Category:PS4 Homebrew math applications]]', ['other'] = '[[List of PS4 homebrew applications#Other applications|Other application]] [[Category:PS4 Homebrew other applications]]', -- Games ['arcade game'] = '[[List of PS4 homebrew games#Arcade|Arcade game]] [[Category:PS4 Homebrew arcade games]]', ['board game'] = '[[List of PS4 homebrew games#Board|Board game]] [[Category:PS4 Homebrew board games]]', ['card game'] = '[[List of PS4 homebrew games#Card|Card game]] [[Category:PS4 Homebrew card games]]', ['game engine'] = '[[List of PS4 homebrew games#Game engine|Game engine]] [[Category:PS4 Homebrew game engines]]', ['music game'] = '[[List of PS4 homebrew games#Music|Music game]] [[Category:PS4 Homebrew music games]]', ['platform game'] = '[[List of PS4 homebrew games#Platform|Platform game]] [[Category:PS4 Homebrew platform games]]', ['puzzle game'] = '[[List of PS4 homebrew games#Puzzle|Puzzle game]] [[Category:PS4 Homebrew puzzle games]]', ['racing game'] = '[[List of PS4 homebrew games#Racing|Racing game]] [[Category:PS4 Homebrew racing games]]', ['role playing game'] = '[[List of PS4 homebrew games#Role playing|Role playing game]] [[Category:PS4 Homebrew role playing games]]', ['shooting game'] = '[[List of PS4 homebrew games#Shooter|Shooting game]] [[Category:PS4 Homebrew shooting games]]', ['simulation game'] = '[[List of PS4 homebrew games#Simulation|Simulation game]] [[Category:PS4 Homebrew simulation games]]', ['trivia game'] = '[[List of PS4 homebrew games#Trivia|Trivia game]] [[Category:PS4 Homebrew trivia games]]', ['other game'] = '[[List of PS4 homebrew games#Other games|Other game]] [[Category:PS4 Homebrew other games]]', -- Emulators ['console emulator'] = '[[List of PS4 homebrew emulators#Console|Console emulator]] [[Category:PS4 Homebrew console emulators]]', ['handheld emulator'] = '[[List of PS4 homebrew emulators#Handheld|Handheld emulator]] [[Category:PS4 Homebrew portable emulators]]', ['arcade emulator'] = '[[List of PS4 homebrew emulators#Arcade|Arcade emulator]] [[Category:PS4 Homebrew arcade emulators]]', ['computer emulator'] = '[[List of PS4 homebrew emulators#Computer|Computer emulator]] [[Category:PS4 Homebrew computer emulators]]', -- Loaders ['loader'] = '[[List of PS4 homebrew loaders|Loader]] [[Category:PS4 Homebrew loaders]]', -- Exploits ['exploit'] = '[[List of PS4 homebrew exploits|Exploit]] [[Category:PS4 Homebrew exploits]]', -- System Tools ['system tool'] = '[[List of PS4 system tools|System tool]] [[Category:PS4 homebrew system tools]]', -- PC Utilities ['pc utility'] = '[[List of PS4 PC utilities|PC utility]] [[Category:PS4 PC utilities]]', -- Demos ['demo'] = '[[List of PS4 homebrew demos|Demo]] [[Category:PS4 homebrew demos]]', } return types[type] or type .. '[[Category:Infobox homebrew using invalid type parameter]]' 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 = { 'PS4x', 'PS4', '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:PS4 open source homebrew]]' end return getLink( 'Source', source ) .. '[[Category:PS4 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:PS4 Homebrew in DownloadMii]]' else return "Version '''" .. dmversion .. "''' downloadable via [[DownloadMii]] [[Category:PS4 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:PS4 Homebrew missing CIA titleID]]' ibData.label113 = 'Unique ID' ibData.data113 = a.uniqueID or 'Unknown[[Category:PS4 Homebrew missing CIA uniqueID]]' end return infobox.infobox( ibData ) end return p