Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.26 KB | None | 0 0
  1. function backGround(colors)
  2.     g2d.BeginQuads()
  3.         g2d.SetColor(colors.white)
  4.         g2d.SetCoordXY(0, 0)
  5.         g2d.Add()
  6.        
  7.         g2d.SetColor(colors.black)
  8.         g2d.SetCoordXY(480, 0)
  9.         g2d.Add()
  10.        
  11.         g2d.SetColor(colors.white)
  12.         g2d.SetCoordXY(480, 272)
  13.         g2d.Add()
  14.        
  15.         g2d.SetColor(colors.black)
  16.         g2d.SetCoordXY(0, 272)
  17.         g2d.Add()
  18.     g2d.End()
  19. end
  20.  
  21. function fadeText(x, y, text, font, size, alpha, endAlpha, addAlpha, color)
  22.     while true do
  23.         g2d.Clear()
  24.        
  25.         if font ~= nil then -- If a font is referenced
  26.             font:print(x, y, text, size, Color.create(Color.getR(color), Color.getG(color), Color.getB(color), alpha), 0, 0, intraFont.CENTER) -- Prints the text with the font
  27.         else
  28.             xtream.print(x, y, text, Color.create(Color.getR(color), Color.getG(color), Color.getB(color), alpha)) -- Else prints with the original font
  29.         end
  30.    
  31.         alpha = alpha + addAlpha -- Increment alpha
  32.    
  33.         if addAlpha ~= 0 then -- If addAlpha isn't null
  34.             if addAlpha > 0 and alpha > endAlpha then -- If addAlpha is positive and has reached its maximum value
  35.                 return true
  36.             elseif addAlpha < 0 and alpha < endAlpha then -- If addAlpha is negative and has reached its maximum value
  37.                 return true
  38.             end
  39.         else -- If alpha is null
  40.             break
  41.         end
  42.         g2d.Flip(g2d.VSYNC)
  43.     end
  44. end
  45.  
  46. function getInfos(filePath, hexVals)
  47.     returnVals = {}
  48.     file = io.open(filePath, "r")
  49.     for i = 1, #hexVals do
  50.         file:seek("set", hexVals[i])
  51.         returnVals[i] = file:read()
  52.     end
  53.     io.close(file)
  54.     return returnVals
  55. end
  56.  
  57. function mainMenu(_table)
  58.     for i = 1, #_table.options do
  59.         _font:print(240, 100 + i * 15, i == 3 and _table.options[3].." et PSPGo" or _table.options[i], 0.85, i == _table.select and _table.selColor or _table.unselColor, 0, 0, intraFont.CENTER)
  60.     end
  61.     Xtream.print(350, 250, "Press O to quit", _table.unselColor)
  62.    
  63.     if pad:up() and not oldpad:up() then
  64.         _table.select = _table.select - (_table.select > 1 and 1 or 0)
  65.     elseif pad:down() and not oldpad:down() then
  66.         _table.select = _table.select + (_table.select < #_table.options and 1 or 0)
  67.     end
  68.    
  69.     if pad:cross() and not oldpad:cross() then
  70.         pspModel = tonumber(string.sub(_table.options[_table.select], 5)) / 1000
  71.         return pspModel
  72.     elseif pad:circle() and not oldpad:circle() then
  73.         Utility.message("Made by Plongeurspros and Dynodzzo\n    Performed with XtreamLua Player", 0)
  74.         Xtream.exitGame()
  75.     end
  76. end
  77.  
  78. Colors = {
  79.             white = Color.create(255, 255, 255),
  80.             black = Color.create(0, 0, 0),
  81.             green = Color.create(17, 140, 33),
  82.          }
  83.  
  84. hexValues = {
  85.                 {"0x37E0", "0x2940", "0x2960"},
  86.                 {"0x3BE0", "0x2D40", "0x2D60"},
  87.                 {"0x3FE0", "0x2F40", "0x2F60"},
  88.             }
  89.  
  90. menuTable = {options = {}, select = 1, selColor = Colors.white, unselColor = Colors.green}
  91. menuTable.options = {"PSP 1000", "PSP 2000", "PSP 3000"}
  92. passNames = {"Parental password - ", "PSN password - ", "PSN e-mail adress - "}
  93. pspModel = nil
  94. values = false
  95. pressSart = false
  96.  
  97. _font = intraFont.load("flash0:/font/ltn8.pgf")
  98.  
  99. oldpad = Ctrl.read()
  100.  
  101. fadeText(240, 136, "Welcome into", _font, 0.8, 0, 255, 2, Colors.white)
  102. Xtream.delay(450)
  103. fadeText(240, 136, "Welcome into", _font, 0.8, 255, 0, -2, Colors.white)
  104. Xtream.delay(450)
  105. fadeText(240, 136, "PSP PassFinder", _font, 1, 0, 255, 2, Colors.white)
  106. Xtream.delay(500)
  107.  
  108. while true do
  109.     g2d.Clear()
  110.     pad = Ctrl.read()
  111.    
  112.     if pressStart ~= true then
  113.         _font:print(240, 136, "PSP PassFinder", 1, Colors.white, 0, 0, intraFont.CENTER)
  114.         _font:print(240, 160, "Press start", 0.7, Colors.white, 0, 0, intraFont.CENTER)
  115.         if pad:start() and not oldpad:start() then
  116.             pressStart = true
  117.         end
  118.     else
  119.         backGround(Colors)
  120.         if pspModel == nil then
  121.             mainMenu(menuTable, pspModel)
  122.         else
  123.             if values ~= true then
  124.                 returnValues = getInfos("flash1:/registry/system.dreg", hexValues[pspModel])
  125.                 values = true
  126.             else
  127.                 for i = 1, #returnValues do
  128.                     if pspModel ~= 3 then
  129.                         _font:print(240, 100 + i * 15, i == 1 and passNames[i]..string.sub(returnValues[i], 1, -8) or passNames[i]..string.sub(returnValues[i], 1, -8), 0.85, Colors.white, 0, 0, intraFont.CENTER)
  130.                     else
  131.                         _font:print(240, 100 + i * 10, i == 1 and passNames[i]..string.sub(returnValues[i], 1, -7) or passNames[i]..string.sub(returnValues[i], 1, -9), 0.85, Colors.white, 0, 0, intraFont.CENTER)
  132.                     end
  133.                     if pad:circle() and not oldpad:circle() then
  134.                         values = false
  135.                         pspModel = nil
  136.                         menuTable.select = 1
  137.                     end
  138.                 end
  139.                 Xtream.print(270, 250, "Press O to return to the menu", Colors.green)
  140.             end
  141.         end
  142.     end
  143.  
  144.     oldpad = pad
  145.     g2d.Flip(g2d.VSYNC)
  146. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement