Advertisement
DiegoRK_PSP

Code SCRIPT.lua de aXMB - PSP

May 26th, 2012
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.50 KB | None | 0 0
  1. position        = 1
  2. limitInf        = 1
  3. White           = color.new(255,255,255)
  4. DeepSkyBlue     = color.new(0,191,255)
  5. Red             = color.new(255,0,0)
  6. ForestGreen         = color.new(34,139,34)
  7. Black           = color.new(0,0,0)
  8. workDir         = files.list("ms0:/")
  9.  
  10. function changeMsc()
  11.     Music = Music + 1
  12.     sndObj= sound.load(listMsc[Music])
  13.     sndObj:play()
  14. end
  15.  
  16. function playMusic()
  17.     if files.ext(workDir[position].name) == "mp3" or files.ext(workDir[position].name) == "wav" then
  18.         if controls.press("cross") then
  19.             sound.play()
  20.         end
  21.         if controls.press("l") then
  22.             changeMsc(-1)
  23.         end
  24.         if controls.press("r") then
  25.             changeMsc(1)
  26.         end
  27.         if controls.press("start") then
  28.             sound.pause()
  29.         end
  30.         if controls.press("square") then
  31.             sound.stop()
  32.             sound.free()
  33.         end
  34.     end
  35. end
  36.  
  37. function exeBackups()
  38.     if controls.press("cross") and files.ext(workDir[position].name) == "iso" then
  39.         os.runiso(workDir[position].name)
  40.     end
  41.     if controls.press("cross") and files.ext(workDir[position].name) == "cso" then
  42.         os.runiso(workDir[position].name)
  43.     end
  44. end
  45.  
  46. function options()
  47.     x=15
  48.     y=20
  49.     site=workDir[position].name
  50.     for i= limitInf, #workDir do
  51.         if y >= 0 and y <= 272 then --Esto, hace que solo se imprima entre esas coordenadas
  52.             if position == i then
  53.                 screen.print(x,y,files.nopath(workDir[i].name),0.6,Black,White)
  54.  
  55.                 else
  56.                 screen.print(x,y,files.nopath(workDir[i].name),0.6,White,0x0)
  57.             end
  58.             y = y+13
  59.             if y >= 260 then y = 277 end --Esto, hace que si supera un limite imprima fuera
  60.         end
  61.     end
  62. end
  63.  
  64. function navegator()
  65.     if controls.press("down") and position ~= #workDir then
  66.         position = position+1
  67.         if position > 19 then limitInf = limitInf+1 end
  68.     end
  69.     if controls.press("up") and position > 1 then
  70.         position = position-1
  71.         if position > 18 then limitInf = limitInf-1 end
  72.     end
  73. end
  74.  
  75. function go()
  76.     if workDir[position].directory then
  77.         position = 1
  78.         limitInf = 1
  79.         workDir = files.list(site)
  80.     end
  81. end
  82.  
  83. function backforward()
  84.     position = 1
  85.     limitInf = 1
  86.     workDir = files.list(files.nofile(files.nofile(site)))
  87. end
  88.  
  89. while true do
  90.     controls.read()
  91.     playMusic()
  92.     exeBackups()
  93.     navegator()
  94.     draw.gradrect(0,0,480,272,DeepSkyBlue,Red,Black,ForestGreen)
  95.     options()
  96.     if controls.press("cross") then
  97.         go()
  98.     end
  99.     if controls.press("triangle") then
  100.         backforward()
  101.     end
  102.     screen.flip()
  103. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement