How to edit OneMenu v2 LUA script files to improve some features

Post or find tutorials, how-to, guides, tips & tricks here
User avatar
redsquirrel87
Blogger
Posts: 20
Joined: Fri Oct 09, 2015 9:47 pm

How to edit OneMenu v2 LUA script files to improve some features

Post by redsquirrel87 » Sat Oct 10, 2015 9:00 pm

Hello,
in this post you can find a few quick tips to improve some functions of OneMenu v2 ;)

Scan /PSP/SAVEDATA/ even for HB and PS1 EBOOTs
I don't know why but OneMenu v2 scans /PSP/SAVEDATA/ path only for ISO/CSO/DAX files and not for HB/PS1 EBOOTs, so you have to install or copy them in others folders (such as VHBL, etc...) to let OneMenu to recognize them.
This might make sense if we could write in /PSP/GAME/ (for compatibility reasons) but since in fw 3.5x we can not write there anymore I think there is no benefit in installing HB/PS1 games, so why don't launch them directly from /PSP/SAVEDATA/ without the need to copy all of them in other folders? This also will let us to manage all our custom folders (containing ISO/HB/PS1...) directly with QCMA without any need to copy/move or delete them using a file manager/FTP on PSVita (note: you need to have a different folder for every ISO/HB/PS1 game since QCMA does not support subfolders).

So, in short, to enable this feature simply edit (with any text editor such as NotePad, gedit, etc...) the OneMenu's SCRIPT.LUA file changing:

Code: Select all

if config[1] then						--Scanning for Zips/Iso/Cso in SAVEDATA
	init_msg(strings.saves)
	scanning_saves()
end
in:

Code: Select all

if config[1] then						--Scanning for Zips/Iso/Cso in SAVEDATA
	init_msg(strings.saves)
	scanning_saves()
	scanning_pbps("ms0:/PSP/SAVEDATA/")
end
That's all :)
Now even HB and PS1 EBOOTs will be recognized by OneMenu without the need to install or move them in other folders :D


Disable gameboot animation (sound + pic)
Just another little mod that let you to disable the gameboot animation (pic + sound) so as to speed up (yeah, it's just a second or a little more :P ) the launch of the games. Just change this function in SHELL.LUA file:

Code: Select all

function rungameboot(pathtogame)
	pic1=nil

	if jump and slide then
		if slide:playing() then slide:stop() end
		if jump:playing() then jump:stop() end
		jump,slide=nil,nil
	end

	local snd=sound.load("SND.S3M")
	if snd then snd:play() end

	if pic then splash(pic,10,3) end

	if snd then
		if snd:playing() then snd:stop() end
		snd=nil
	end

	games,button,mimes,pic=nil,nil,nil,nil
	collectgarbage("collect")
	os.delay(5)
	game.launch(pathtogame)
end
with:

Code: Select all

function rungameboot(pathtogame)
	pic1=nil

	if jump and slide then
		if slide:playing() then slide:stop() end
		if jump:playing() then jump:stop() end
		jump,slide=nil,nil
	end

	games,button,mimes,pic=nil,nil,nil,nil
	collectgarbage("collect")
	os.delay(5)
	game.launch(pathtogame)
end
Now when you click X on a game/HB then OneMenu will launch it directly without showing any gameboot animation.


Disable resizing of square ICON0 (PS1 games, MINIS...) so as avoiding the stretching
Another little mod to disable the resizing of ICON0 for those games/HB that have a square one so as avoiding the bad stretching.
Just edit the SCAN.LUA file changing this function:

Code: Select all

function fill_scan(var, temp, path, name, ind)
	if not ind then
		table.insert(games[var],{})
		ind=#games[var]
	end

	games[var][ind].title = temp.TITLE
	games[var][ind].name = name	
	games[var][ind].cat = temp.CATEGORY

	games[var][ind].path = path
	games[var][ind].icono = game.geticon0(path)

	if (not games[var][ind].icono) and default_icon then
		games[var][ind].icono = image.copy(default_icon)
	end
	games[var][ind].icono:resize(100,68)

	--boots
	if config[11]==path then boots[path] = 0 		--square
	elseif config[12]==path then boots[path] = 1 	--triangle
	elseif config[13]==path then boots[path] = 2 	--circle
	elseif config[14]==path then boots[path] = 3 	--cross 
	end
end
with:

Code: Select all

function fill_scan(var, temp, path, name, ind)
	if not ind then
		table.insert(games[var],{})
		ind=#games[var]
	end

	games[var][ind].title = temp.TITLE
	games[var][ind].name = name	
	games[var][ind].cat = temp.CATEGORY

	games[var][ind].path = path
	games[var][ind].icono = game.geticon0(path)

	if (not games[var][ind].icono) and default_icon then
		games[var][ind].icono = image.copy(default_icon)
	end

	if (games[var][ind].icono:getw() > 80) then 
		games[var][ind].icono:resize(100,68)
	else 
		games[var][ind].icono:resize(68,68)
	end

	--boots
	if config[11]==path then boots[path] = 0 		--square
	elseif config[12]==path then boots[path] = 1 	--triangle
	elseif config[13]==path then boots[path] = 2 	--circle
	elseif config[14]==path then boots[path] = 3 	--cross 
	end
end
And then edit even the SHELL.LUA file changing this function:

Code: Select all

function graphics.focus_icon()
	draw.fillrect(0,0,480,24, BarColor) --UP
	screen.print(5,5,games[cat][focus_index].title,0.6)

	games[cat][focus_index].icono:resize(140,80)
	games[cat][focus_index].icono:blit(45,100 - (graphics.elev / 2))

	if boots[games[cat][focus_index].path] then
		if boots[games[cat][focus_index].path] < 4 then
			button:blitsprite(45+140-20,100 - (graphics.elev / 2),boots[games[cat][focus_index].path],175)
		end
	end

	games[cat][focus_index].icono:flipv()
	games[cat][focus_index].icono:blit(45,205 + (graphics.elev / 2),60)
	games[cat][focus_index].icono:flipv()

	graphics.elev+=2
	if graphics.elev > 15 then graphics.elev = 15 end

	games[cat][focus_index].icono:resize(100,68)

	draw.fillrect(0,252,480,20, BarColor)--Down
	if not scrollx_name then scrollx_name = 12 end
	scrollx_name = screen.print(scrollx_name,255,games[cat][focus_index].name,0.6,color.white,0x0,__SLEFT,300)
	screen.print(475,255,os.date("%I:%M %p"),0.5,color.white,color.gray,__ARIGHT)
end
with:

Code: Select all

function graphics.focus_icon()
	draw.fillrect(0,0,480,24, BarColor) --UP
	screen.print(5,5,games[cat][focus_index].title,0.6)

        if (games[cat][focus_index].icono:getw() > 80) then 
	        games[cat][focus_index].icono:resize(144,80)
        else
	        games[cat][focus_index].icono:resize(80,80)
        end
	games[cat][focus_index].icono:blit(45,100 - (graphics.elev / 2))

	if boots[games[cat][focus_index].path] then
		if boots[games[cat][focus_index].path] < 4 then
			button:blitsprite(45+140-20,100 - (graphics.elev / 2),boots[games[cat][focus_index].path],175)
		end
	end

	games[cat][focus_index].icono:flipv()
	games[cat][focus_index].icono:blit(45,205 + (graphics.elev / 2),60)
	games[cat][focus_index].icono:flipv()

	graphics.elev+=2
	if graphics.elev > 15 then graphics.elev = 15 end

	
        if (games[cat][focus_index].icono:getw() > 80) then 
	        games[cat][focus_index].icono:resize(100,68)
        else
	        games[cat][focus_index].icono:resize(68,68)
        end

	draw.fillrect(0,252,480,20, BarColor)--Down
	if not scrollx_name then scrollx_name = 12 end
	scrollx_name = screen.print(scrollx_name,255,games[cat][focus_index].name,0.6,color.white,0x0,__SLEFT,300)
	screen.print(475,255,os.date("%I:%M %p"),0.5,color.white,color.gray,__ARIGHT)
end
Done! Now MINIS, PS1 games, etc... that have not a rectangular ICON0 will not be stretched anymore by OneMenu shell :)


Fix NO GAMES crash
In case of no games found (or if you disable all search functions from OneMenu settings) the program crashes, so you can not do anything to change options or explore ms0. This little mod fix this, just edit SCRIPT.LUA file changing:

Code: Select all

if config[9] then pic1=game.getpic1(games[cat][1].path) end-- 1er PIC1
with:

Code: Select all

if config[9] then 
	if (games[cat][1] != nil) then
		pic1=game.getpic1(games[cat][1].path) 
	end
end-- 1er PIC1
Now when the program will find no games it just will show the NO GAMES message and should not crash anymore ;)
Last edited by redsquirrel87 on Thu Oct 15, 2015 3:59 pm, edited 1 time in total.
User avatar
gdljjrod
Junior Member
Posts: 16
Joined: Thu Mar 13, 2014 9:48 pm

RE: Editing OneMenu v2 to scan /PSP/SAVEDATA/ even for HB/PS1 EBOOTs

Post by gdljjrod » Sun Oct 11, 2015 2:10 am

remember before
QCMA not transfer subfolders
but I like your idea :P

thks :D
User avatar
redsquirrel87
Blogger
Posts: 20
Joined: Fri Oct 09, 2015 9:47 pm

RE: Editing OneMenu v2 to scan /PSP/SAVEDATA/ even for HB/PS1 EBOOTs

Post by redsquirrel87 » Sun Oct 11, 2015 8:25 am

gdljjrod wrote: remember before
QCMA not transfer subfolders
but I like your idea :P

thks :D
Thank you,
yeah, this means that more complex homebrews with subfolders (like emulators) still need an installation. But I think that this is still an improvement since most of the homebrews are very simple, with only the EBOOT.PBP or at max some other files but always in the root, and PS1 EBOOTs are usually heavier (some even overtake 1,5GB) and to copy/install them it's not very fast xD
P.s.: and just to clarify, this mod simply add the ability to scan even for HB/PS1 EBOOTs in /PSP/SAVEDATA/, don't disable or break any existing feature of OneMenu, so there is no risk or damage to do it and you can continue to use every other method to install/launch custom content ;)
User avatar
gdljjrod
Junior Member
Posts: 16
Joined: Thu Mar 13, 2014 9:48 pm

RE: Editing OneMenu v2 to scan /PSP/SAVEDATA/ even for HB/PS1 EBOOTs

Post by gdljjrod » Mon Oct 12, 2015 2:00 pm

redsquirrel87 wrote:
gdljjrod wrote: remember before
QCMA not transfer subfolders
but I like your idea :P

thks :D
Thank you,
yeah, this means that more complex homebrews with subfolders (like emulators) still need an installation. But I think that this is still an improvement since most of the homebrews are very simple, with only the EBOOT.PBP or at max some other files but always in the root, and PS1 EBOOTs are usually heavier (some even overtake 1,5GB) and to copy/install them it's not very fast xD
P.s.: and just to clarify, this mod simply add the ability to scan even for HB/PS1 EBOOTs in /PSP/SAVEDATA/, don't disable or break any existing feature of OneMenu, so there is no risk or damage to do it and you can continue to use every other method to install/launch custom content ;)
Yup...
install in subfolders

SAVEDATA/HB1/EBOOT.PBP
SAVEDATA/HB2/EBOOT.PBP
SAVEDATA/PARAM.SFO, ICON0.PNG..etc

transfer with QCMA and ONEMenu actived SCAN SAVES and SCAN CATEGORIES :P
User avatar
redsquirrel87
Blogger
Posts: 20
Joined: Fri Oct 09, 2015 9:47 pm

RE: Editing OneMenu v2 to scan /PSP/SAVEDATA/ even for HB/PS1 EBOOTs

Post by redsquirrel87 » Mon Oct 12, 2015 2:06 pm

gdljjrod wrote:
redsquirrel87 wrote:
gdljjrod wrote: remember before
QCMA not transfer subfolders
but I like your idea :P

thks :D
Thank you,
yeah, this means that more complex homebrews with subfolders (like emulators) still need an installation. But I think that this is still an improvement since most of the homebrews are very simple, with only the EBOOT.PBP or at max some other files but always in the root, and PS1 EBOOTs are usually heavier (some even overtake 1,5GB) and to copy/install them it's not very fast xD
P.s.: and just to clarify, this mod simply add the ability to scan even for HB/PS1 EBOOTs in /PSP/SAVEDATA/, don't disable or break any existing feature of OneMenu, so there is no risk or damage to do it and you can continue to use every other method to install/launch custom content ;)
Yup...
install in subfolders

SAVEDATA/HB1/EBOOT.PBP
SAVEDATA/HB2/EBOOT.PBP
SAVEDATA/PARAM.SFO, ICON0.PNG..etc

transfer with QCMA and ONEMenu actived SCAN SAVES and SCAN CATEGORIES :P
Are you saying that OneMenu can already scan HB/PS1 games in /PSP/SAVEDATA/ even without this mod? Because if so I tried many times and even like you said (inserting HB in folders named exactly HB1, HB2, ecc... and enabling the options SCAN SAVES and SCAN CATEGORIES) but they are not recognized by OneMenu shell without this mod :S
Last edited by redsquirrel87 on Mon Oct 12, 2015 2:23 pm, edited 1 time in total.
User avatar
gdljjrod
Junior Member
Posts: 16
Joined: Thu Mar 13, 2014 9:48 pm

RE: Editing OneMenu v2 to scan /PSP/SAVEDATA/ even for HB/PS1 pbps and disable gameboot

Post by gdljjrod » Mon Oct 12, 2015 3:52 pm

redsquirrel87 wrote:
gdljjrod wrote:
redsquirrel87 wrote:
gdljjrod wrote: remember before
QCMA not transfer subfolders
but I like your idea :P

thks :D
Thank you,
yeah, this means that more complex homebrews with subfolders (like emulators) still need an installation. But I think that this is still an improvement since most of the homebrews are very simple, with only the EBOOT.PBP or at max some other files but always in the root, and PS1 EBOOTs are usually heavier (some even overtake 1,5GB) and to copy/install them it's not very fast xD
P.s.: and just to clarify, this mod simply add the ability to scan even for HB/PS1 EBOOTs in /PSP/SAVEDATA/, don't disable or break any existing feature of OneMenu, so there is no risk or damage to do it and you can continue to use every other method to install/launch custom content ;)
Yup...
install in subfolders

SAVEDATA/HB1/EBOOT.PBP
SAVEDATA/HB2/EBOOT.PBP
SAVEDATA/PARAM.SFO, ICON0.PNG..etc

transfer with QCMA and ONEMenu actived SCAN SAVES and SCAN CATEGORIES :P
Are you saying that OneMenu can already scan HB/PS1 games in /PSP/SAVEDATA/ even without this mod? Because if so I tried many times and even like you said (inserting HB in folders named exactly HB1, HB2, ecc... and enabling the options SCAN SAVES and SCAN CATEGORIES) but they are not recognized by OneMenu shell without this mod :S
only in your MOD :P
User avatar
gdljjrod
Junior Member
Posts: 16
Joined: Thu Mar 13, 2014 9:48 pm

RE: Editing OneMenu v2 to scan /PSP/SAVEDATA/ even for HB/PS1 pbps and disable gameboot

Post by gdljjrod » Mon Oct 12, 2015 3:56 pm

next version maybe animation launch a .PMF :P
User avatar
redsquirrel87
Blogger
Posts: 20
Joined: Fri Oct 09, 2015 9:47 pm

RE: How to edit OneMenu v2 LUA script files to improve some functions

Post by redsquirrel87 » Tue Oct 13, 2015 9:06 pm

Reordered the first post and added another tip to avoid stretching for square icons ;)
Last edited by redsquirrel87 on Tue Oct 13, 2015 9:06 pm, edited 1 time in total.
User avatar
gdljjrod
Junior Member
Posts: 16
Joined: Thu Mar 13, 2014 9:48 pm

RE: How to edit OneMenu v2 LUA script files to improve some features

Post by gdljjrod » Sat Oct 24, 2015 9:25 pm

redsquirrel87 wrote: Reordered the first post and added another tip to avoid stretching for square icons ;)
thks..add in the new versions your FIX
thks

no resize in MINIS
https://dl.dropboxusercontent.com/u/487 ... _minis.png

Open Menu in NO GAMES :P
https://dl.dropboxusercontent.com/u/487 ... nslide.png

Disable gameboot animation (sound + pic)
blablabla...
Only no put file SND.S3M in your savedata :D
Last edited by gdljjrod on Sat Oct 24, 2015 9:29 pm, edited 1 time in total.
User avatar
redsquirrel87
Blogger
Posts: 20
Joined: Fri Oct 09, 2015 9:47 pm

RE: How to edit OneMenu v2 LUA script files to improve some features

Post by redsquirrel87 » Sat Oct 24, 2015 9:46 pm

Great, I'm glad I could be useful xD
Where can I download the new version? Or is it unreleased yet?
Thank you
Post Reply