@@ -17,19 +17,17 @@ function update_configtxt(path, tb_config, options)
1717 -- Update Line install_psp_psx_location
1818 if line_find_install_location > 0 then tb_config [line_find_install_location ] = " install_psp_psx_location " .. options [2 ].status end
1919
20- -- Remove lines for install_psp_as_pbp & psm_disclaimer_yes_i_read_the_readme ??
21- if line_find_install_as_pbp > line_find_add_psm then
22- if options [1 ].status == false then table.remove (tb_config ,line_find_install_as_pbp ) end
23- if options [3 ].status == false then table.remove (tb_config ,line_find_add_psm ) end
24- elseif line_find_install_as_pbp < line_find_add_psm then
25- if options [3 ].status == false then table.remove (tb_config ,line_find_add_psm ) end
26- if options [1 ].status == false then table.remove (tb_config ,line_find_install_as_pbp ) end
20+ -- Remove lines for psm_disclaimer_yes_i_read_the_readme
21+ if line_find_add_psm > 0 then
22+ table.remove (tb_config ,line_find_add_psm )
2723 end
2824
25+ -- Remove lines for install_psp_as_pbp
26+ if options [1 ].status == false then table.remove (tb_config ,line_find_install_as_pbp ) end
27+
2928 -- Insert new lines
3029 if line_find_install_location == 0 then table.insert (tb_config , " install_psp_psx_location " .. options [2 ].status ) end
3130 if line_find_install_as_pbp == 0 and options [1 ].status == true then table.insert (tb_config , " install_psp_as_pbp 1" ) end
32- if line_find_add_psm == 0 and options [3 ].status == true then table.insert (tb_config , " psm_disclaimer_yes_i_read_the_readme NoPsmDrm" ) end
3331
3432 -- Update config.txt
3533 local fp = io.open (path , " w+" )
4240
4341function read_config (file , tb_config )
4442
45- if not files .exists (file ) then
46- if files .exists (" ux0:pkgi/config.txt" ) then
47- file = " ux0:pkgi/config.txt"
48- else
49- files .new (" ux0:pkgj/config.txt" )
50- file = " ux0:pkgj/config.txt"
51- -- return nil
52- end
53- end
43+ files .mkdir (files .nofile (file ))
44+ if not files .exists (file ) then files .new (file ) end
5445
5546 local cont = 0
5647 for line in io.lines (file ) do
@@ -90,18 +81,20 @@ local psp_psx_location_callback = function (obj)
9081
9182end
9283
93- local add_psm_callback = function (obj )
94- obj .status = not obj .status
95- end
96-
9784function config_pkgj ()
9885
9986 -- Clean
10087 line_find_install_as_pbp , line_find_install_location , line_find_add_psm = 0 ,0 ,0
10188 mount_install = " ux0:"
10289 local tb_config = {}
10390
104- local check_config = read_config (" ux0:pkgj/config.txt" , tb_config )
91+ local path_configtxt = " ux0:pkgj/config.txt"
92+ if files .exists (" ur0:pkgj/config.txt" ) then path_configtxt = " ur0:pkgj/config.txt"
93+ elseif files .exists (" ux0:pkgj/config.txt" ) then path_configtxt = " ux0:pkgj/config.txt"
94+ elseif files .exists (" ur0:pkgi/config.txt" ) then path_configtxt = " ur0:pkgi/config.txt"
95+ elseif files .exists (" ux0:pkgi/config.txt" ) then path_configtxt = " ux0:pkgi/config.txt" end
96+
97+ local check_config = read_config (path_configtxt , tb_config )
10598 if not check_config then
10699 if vbuff then vbuff :blit (0 ,0 ) elseif back2 then back2 :blit (0 ,0 ) end
107100 message_wait (LANGUAGE [" NO_CONFIG_PKGJ" ])
@@ -117,14 +110,12 @@ function config_pkgj()
117110 local menuext = {
118111 { text = LANGUAGE [" PKGJ_TITLE_INSTALL_PBP" ], desc = LANGUAGE [" PKGJ_DESC_INSTALL_PBP" ], status = false , funct = psp_eboot_callback },
119112 { text = LANGUAGE [" PKGJ_TITLE_CHANGE_LOC" ], desc = LANGUAGE [" PKGJ_DESC_CHANGE_LOC" ], status = " ux0:" , funct = psp_psx_location_callback },
120- { text = LANGUAGE [" PKGJ_TITLE_ADD_PSM" ], desc = LANGUAGE [" PKGJ_DESC_ADD_PSM" ], status = false , funct = add_psm_callback },
121113 }
122114
123115 -- UPdate Status
124116 if line_find_install_as_pbp > 0 then menuext [1 ].status = true end
125117 if pmount == 0 then menuext [2 ].pmount = 1 else menuext [2 ].pmount = pmount end
126118 menuext [2 ].status = PMounts [menuext [2 ].pmount ]
127- if line_find_add_psm > 0 then menuext [3 ].status = true end
128119
129120 local scroll ,xscroll = newScroll (menuext ,# menuext ),5
130121 while true do
@@ -141,7 +132,6 @@ function config_pkgj()
141132
142133 if i == scroll .sel then draw .offsetgradrect (3 ,y - 10 ,952 ,38 ,color .shine :a (75 ),color .shine :a (135 ),0x0 ,0x0 ,21 ) end
143134
144- -- if i == scroll.sel then draw.fillrect(3,y-4,952,26,color.green:a(105)) end
145135 screen .print (25 ,y , menuext [i ].text )
146136
147137 if menuext [i ].status == true then
@@ -155,6 +145,8 @@ function config_pkgj()
155145 y += 35
156146 end
157147
148+ screen .print (480 , 360 , path_configtxt ,1.2 ,color .green ,0x0 ,__ACENTER )
149+
158150 if screen .textwidth (menuext [scroll .sel ].desc ) > 925 then
159151 xscroll = screen .print (xscroll , 400 , menuext [scroll .sel ].desc ,1 ,color .white ,color .blue ,__SLEFT ,935 )
160152 else
@@ -200,8 +192,6 @@ function config_pkgj()
200192
201193 if buttons .triangle then
202194
203- -- local vbuff = screen.toimage()
204- -- if vbuff then vbuff:blit(0,0) elseif back2 then back2:blit(0,0) end
205195 if back2 then back2 :blit (0 ,0 ) end
206196 message_wait (LANGUAGE [" PKGJ_UPDATING" ])
207197 os .delay (1500 )
0 commit comments