|
| 1 | +AlienShooter = false |
| 2 | + |
| 3 | +--Ckecking game Alien Shooter |
| 4 | +Alien = { |
| 5 | + { id = "PCSE00445", region = "North America" }, |
| 6 | + { id = "PCSB00561", region = "Europe" }, |
| 7 | +} |
| 8 | + |
| 9 | +gamesAlien = {} |
| 10 | +for i=1,#Alien do |
| 11 | + if game.exists(Alien[i].id) then |
| 12 | + AlienShooter = true |
| 13 | + table.insert(gamesAlien,Alien[i]) |
| 14 | + end |
| 15 | +end |
| 16 | + |
| 17 | +function AlienShooter_DLC_Unlocker() |
| 18 | + |
| 19 | + if not AlienShooter then os.message(LANGUAGE["NO_ALIENSHOOTER_GAMES"]) end |
| 20 | + |
| 21 | + local AlienShooter_ID = "ALIENDLC.png" |
| 22 | + |
| 23 | + local patches = { |
| 24 | + { res = LANGUAGE["MENU_PSVITA_AL_DLC_UNLOCKER"], desc = LANGUAGE["INSTALLP_DESC_ALIENDLC"], path = "alienhook.suprx" }, |
| 25 | + } |
| 26 | + |
| 27 | + for i=1,#patches do |
| 28 | + for j=1,#plugins do |
| 29 | + if patches[i].desc == plugins[j].desc then |
| 30 | + patches[i].res = plugins[j].name |
| 31 | + end |
| 32 | + end |
| 33 | + end |
| 34 | + |
| 35 | + local scroll,selector,xscroll = newScroll(patches,#patches),1,10 |
| 36 | + while true do |
| 37 | + buttons.read() |
| 38 | + if change or ReloadConfig then buttons.homepopup(0) else buttons.homepopup(1) end |
| 39 | + |
| 40 | + if back2 then back2:blit(0,0) end |
| 41 | + if snow then stars.render() end |
| 42 | + wave:blit(0.7,50) |
| 43 | + |
| 44 | + draw.fillrect(0,0,960,55,color.shine:a(15)) |
| 45 | + --draw.offsetgradrect(0,0,960,55,color.black:a(85),color.black:a(135),0x0,0x0,20)-- |
| 46 | + screen.print(480,20,LANGUAGE["MENU_PSVITA_AL_DLC_UNLOCKER"],1.0,color.white,color.blue,__ACENTER) |
| 47 | + |
| 48 | + draw.fillrect(0,64,960,322,color.shine:a(25)) |
| 49 | + |
| 50 | + --Games |
| 51 | + local xRoot = 200 |
| 52 | + local w = (955-xRoot)/#gamesAlien |
| 53 | + for i=1, #gamesAlien do |
| 54 | + if selector == i then |
| 55 | + draw.fillrect(xRoot,63,w,42, color.green:a(90)) |
| 56 | + end |
| 57 | + screen.print(xRoot+(w/2), 75, gamesAlien[i].id, 1, color.white, color.blue, __ACENTER) |
| 58 | + draw.fillrect(750,435,200,42, color.shine:a(25)) |
| 59 | + screen.print(940,445,gamesAlien[selector].region,1,color.white,color.blue, __ARIGHT) |
| 60 | + xRoot += w |
| 61 | + end |
| 62 | + |
| 63 | + local y = 155 |
| 64 | + for i=scroll.ini, scroll.lim do |
| 65 | + |
| 66 | + if i == scroll.sel then draw.offsetgradrect(3,y-10,952,38,color.shine:a(75),color.shine:a(135),0x0,0x0,21) end |
| 67 | + |
| 68 | + idx = tai.find(gamesAlien[selector].id,patches[i].path) |
| 69 | + if idx != nil then |
| 70 | + if files.exists(tai.gameid[ gamesAlien[selector].id ].prx[idx].path) then |
| 71 | + if dotg then dotg:blit(924,y-1) else draw.fillrect(924,y-2,21,21,color.green:a(205)) end |
| 72 | + else |
| 73 | + if doty then doty:blit(924,y-1) else draw.fillrect(924,y-2,21,21,color.yellow:a(205)) end |
| 74 | + end |
| 75 | + end |
| 76 | + |
| 77 | + screen.print(25,y, patches[i].res) |
| 78 | + y+=45 |
| 79 | + end |
| 80 | + |
| 81 | + if patches[scroll.sel].desc then |
| 82 | + if screen.textwidth(patches[scroll.sel].desc) > 925 then |
| 83 | + xscroll = screen.print(xscroll, 400, patches[scroll.sel].desc,1,color.green,0x0,__SLEFT,935) |
| 84 | + else |
| 85 | + screen.print(480, 400, patches[scroll.sel].desc,1,color.green,0x0,__ACENTER) |
| 86 | + end |
| 87 | + end |
| 88 | + |
| 89 | + if #gamesAlien > 1 then |
| 90 | + if buttonskey2 then buttonskey2:blitsprite(5,448,2) end |
| 91 | + if buttonskey2 then buttonskey2:blitsprite(35,448,3) end |
| 92 | + screen.print(70,450, LANGUAGE["INSTALL_P4G_HD_CHANGE"],1,color.white,color.black,__ALEFT) |
| 93 | + end |
| 94 | + |
| 95 | + if buttonskey then buttonskey:blitsprite(10, 483, saccept) end |
| 96 | + screen.print(40, 485, LANGUAGE["MENU_INSTALL_INFO"], 1, color.white, color.black, __ALEFT) |
| 97 | + |
| 98 | + if buttonskey then buttonskey:blitsprite(10,518,scancel) end |
| 99 | + screen.print(40,522,LANGUAGE["STRING_BACK"],1,color.white,color.black, __ALEFT) |
| 100 | + |
| 101 | + if buttonskey3 then buttonskey3:blitsprite(920,518,1) end |
| 102 | + screen.print(915,522,LANGUAGE["STRING_CLOSE"],1,color.white,color.blue, __ARIGHT) |
| 103 | + |
| 104 | + screen.flip() |
| 105 | + |
| 106 | + -------------------------- Controls -------------------------- |
| 107 | + |
| 108 | + if buttons.cancel then break end |
| 109 | + |
| 110 | + --Exit |
| 111 | + if buttons.start then |
| 112 | + exit_bye_bye() |
| 113 | + end |
| 114 | + |
| 115 | + vol_mp3() |
| 116 | + |
| 117 | + if scroll.maxim > 0 then |
| 118 | + |
| 119 | + if buttons.left or buttons.right then xscroll = 10 end |
| 120 | + |
| 121 | + if buttons.up or buttons.analogly < -60 then |
| 122 | + if scroll:up() then xscroll = 10 end |
| 123 | + end |
| 124 | + if buttons.down or buttons.analogly > 60 then |
| 125 | + if scroll:down() then xscroll = 10 end |
| 126 | + end |
| 127 | + |
| 128 | + --L/R |
| 129 | + if buttons.released.l or buttons.released.r then |
| 130 | + if buttons.released.l then selector -= 1 else selector += 1 end |
| 131 | + if selector > #gamesAlien then selector = 1 |
| 132 | + elseif selector < 1 then selector = #gamesAlien end |
| 133 | + end |
| 134 | + |
| 135 | + if buttons.accept then |
| 136 | + |
| 137 | + local vbuff = screen.buffertoimage() |
| 138 | + |
| 139 | + local onNetGetFileOld = onNetGetFile |
| 140 | + onNetGetFile = nil |
| 141 | + |
| 142 | + local img = image.load(screenshots..AlienShooter_ID) |
| 143 | + if not img then |
| 144 | + if http.download(string.format("https://raw.githubusercontent.com/%s/%s/master/screenshots/%s", APP_REPO, APP_PROJECT, AlienShooter_ID), screenshots..AlienShooter_ID).success then |
| 145 | + img = image.load(screenshots..AlienShooter_ID) |
| 146 | + end |
| 147 | + end |
| 148 | + |
| 149 | + onNetGetFile = onNetGetFileOld |
| 150 | + if img then |
| 151 | + if vbuff then vbuff:blit(0,0) elseif back2 then back2:blit(0,0) end |
| 152 | + img:scale(85) |
| 153 | + img:center() |
| 154 | + img:blit(480,272) |
| 155 | + screen.flip() |
| 156 | + --buttons.waitforkey() |
| 157 | + os.delay(1200) |
| 158 | + end |
| 159 | + img,vbuff = nil,nil |
| 160 | + |
| 161 | + Patch_AlienShooter_install(gamesAlien[selector],patches[scroll.sel]) |
| 162 | + end |
| 163 | + |
| 164 | + end |
| 165 | + |
| 166 | + end |
| 167 | + |
| 168 | +end |
| 169 | + |
| 170 | +function Patch_AlienShooter_install(game,res) |
| 171 | + |
| 172 | + --Copy plugin to tai folder |
| 173 | + files.copy(path_plugins..res.path, path_tai) |
| 174 | + tai.put(game.id, path_tai..res.path) |
| 175 | + ReloadConfig = true |
| 176 | + |
| 177 | + if back2 then back2:blit(0,0) end |
| 178 | + message_wait(res.res.."\n\n"..LANGUAGE["STRING_INSTALLED"]) |
| 179 | + os.delay(850) |
| 180 | + |
| 181 | +end |
0 commit comments