1+ function search_gameid ()
2+
3+ local descript = LANGUAGE [" MENU_PSVITA_INSTALL_NEAREST" ]
4+ for j = 1 ,# plugins do
5+ if " INSTALLP_DESC_VITANEARESTN" == plugins [j ].KEY then
6+ descript = plugins [j ].name
7+ end
8+ end
9+
10+ local list_tmp = game .list (__GAME_LIST_APP )
11+ local tmp = {
12+ title = " ALL" , id = " ALL"
13+ }
14+
15+ if list_tmp then
16+ table.sort (list_tmp , function (a ,b ) return string.lower (a .title )< string.lower (b .title ) end )
17+ table.insert (list_tmp , 1 , tmp )
18+ end
19+
20+ local limit = 9
21+ local scroll = newScroll (list_tmp ,limit )
22+ local xscroll = 13
23+
24+ buttons .interval (10 ,6 )
25+ while true do
26+ buttons .read ()
27+ if change or ReloadConfig then buttons .homepopup (0 ) else buttons .homepopup (1 ) end
28+
29+ if back then back :blit (0 ,0 ) end
30+
31+ draw .offsetgradrect (0 ,0 ,960 ,55 ,color .blue :a (85 ),color .blue :a (85 ),0x0 ,0x0 ,20 )
32+ screen .print (480 ,20 ,LANGUAGE [" MENU_PSVITA_INSTALL_NEAREST" ],1.2 ,color .white ,0x0 ,__ACENTER )
33+
34+ local y = 65
35+ for i = scroll .ini , scroll .lim do
36+ if i == scroll .sel then draw .offsetgradrect (5 ,y - 12 ,943 ,40 ,color .shine :a (75 ),color .shine :a (135 ),0x0 ,0x0 ,21 ) end
37+
38+ if screen .textwidth (list_tmp [i ].title ) > 925 then
39+ xscroll = screen .print (xscroll , y , list_tmp [i ].title ,1 ,color .white ,color .blue ,__SLEFT ,935 )
40+ else
41+ screen .print (13 , y , list_tmp [i ].title ,1 ,color .white ,color .blue ,__ALEFT )
42+ end
43+
44+ screen .print (938 ,y ,list_tmp [i ].id ,1.2 ,color .white ,0x0 ,__ARIGHT )
45+ y += 45
46+ end
47+
48+ ---- Draw Scroll Bar
49+ local ybar ,hbar = 55 , (limit * 45 )
50+ draw .fillrect (950 ,ybar - 2 ,8 ,hbar ,color .shine )
51+ -- if scroll.maxim >= limit then
52+ local pos_height = math.max (hbar / scroll .maxim , limit )
53+ -- Bar Scroll
54+ draw .fillrect (950 , ybar - 2 + ((hbar - pos_height )/ (scroll .maxim - 1 ))* (scroll .sel - 1 ), 8 , pos_height , color .new (0 ,255 ,0 ))
55+ -- end
56+
57+ screen .print (480 , 490 , descript ,1 ,color .white ,color .blue ,__ACENTER )
58+
59+ if buttonskey then buttonskey :blitsprite (10 ,523 ,scancel ) end
60+ screen .print (45 ,525 ,LANGUAGE [" STRING_BACK" ],1 ,color .white ,color .black , __ALEFT )
61+
62+ if buttonskey3 then buttonskey3 :blitsprite (920 ,518 ,1 ) end
63+ screen .print (915 ,522 ,LANGUAGE [" STRING_CLOSE" ],1 ,color .white ,color .blue , __ARIGHT )
64+
65+ screen .flip ()
66+
67+ ---- ---------------------- Controls --------------------------
68+
69+ if buttons .released .cancel then break end
70+
71+ -- Exit
72+ if buttons .start then
73+ exit_bye_bye ()
74+ end
75+
76+ vol_mp3 ()
77+
78+ if scroll .maxim > 0 then
79+ if buttons .left or buttons .right then xscroll = 10 end
80+
81+ if buttons .up or buttons .analogly < - 60 then
82+ if scroll :up () then xscroll = 10 end
83+ end
84+ if buttons .down or buttons .analogly > 60 then
85+ if scroll :down () then xscroll = 10 end
86+ end
87+
88+ if buttons .accept then
89+ return list_tmp [scroll .sel ].id
90+ end
91+ end
92+
93+ end
94+
95+ end
96+
97+
98+ function VitaNearest ()
99+
100+ -- if os.dialog(LANGUAGE["MENU_PSVITA_INSTALL_NEAREST_Q"], LANGUAGE["MENU_PSVITA_INSTALL_NEAREST"], __DIALOG_MODE_OK_CANCEL) == true then
101+ local _section = search_gameid ()
102+ if _section then
103+
104+ -- os.message(_section)
105+
106+ if _section == " ALL" then
107+ -- Buscar todos los gameids de este plugin y borrarlos de tai
108+ local ids = tai .findALL (" VitaNearestNeighbour.suprx" )
109+ if ids then
110+ for i = 1 ,# ids do
111+ -- os.message()
112+ tai .del (ids [i ].section ," VitaNearestNeighbour.suprx" )
113+ end
114+ end
115+
116+ files .copy (path_plugins .. " VitaNearestNeighbour.suprx" , path_tai )
117+ tai .put (" ALL" , " ur0:tai/VitaNearestNeighbour.suprx" )
118+ ReloadConfig = true
119+
120+ os .message (" VitaNearestNeighbour.suprx\n\n ALL\n\n " .. LANGUAGE [" STRING_INSTALLED" ])
121+
122+ else
123+ files .copy (path_plugins .. " VitaNearestNeighbour.suprx" , path_tai )
124+ tai .del (" ALL" , " VitaNearestNeighbour.suprx" )
125+ tai .put (_section , " ur0:tai/VitaNearestNeighbour.suprx" )
126+ ReloadConfig = true
127+
128+ os .message (" VitaNearestNeighbour.suprx" .. " \n\n " .. _section .. " \n\n " .. LANGUAGE [" STRING_INSTALLED" ])
129+ end
130+
131+ end
132+
133+ end
0 commit comments