Modified RocketLauncher Plugin RetroFE - possible workaround for (fade)

hundergrn07

New member
RL Member
So with wanting to use fades and RetroFE not playing nice with the fades I tried to work out some of the problem. This is what I have so far:

If you decide to use this, BACKUP your old plugin and be sure to change the temp frontendPath line to your RetroFE folder.

While the meta.db is unable to be read by Rocketlauncher the xml databases found in the meta/hyperlist folder can. This is a work around untill SQL is support. It may be a mess but it works.

For this to work you need to change the frontend path within the plugin script.

Code:
; RetroFE Plugin
; RetroFE Plugin

PluginInit:
	Log("PluginInit - Started")

	; Load Plugin settings
		;---- Plugin Information
	;frontend info (required)
	frontendPlugin := "RetroFE" 
	frontendWinTitle := "RetroFE"
	frontendWinClass := "RetroFE ahk_class SDL_app"


	
;Acquiring RetroFE DIR path possible issues with conversion of ut8 to ansi

;	rocketlauncher_frontend_ini = ..\RocketLauncherUI\Settings\Frontends.ini
;	IniRead, rl_fe_ini, %rocketlauncher_frontend_ini%,RetroFE,Path
;	frontendPath := % SubStr(rl_fe_ini, InStr(rl_fe_ini, "RetroFE") + 1)
	
;.....................................................................	
;Temp CHANGE FOR YOUR FRONT END PATH
;.....................................................................
	frontendpath := "D:\Frontend\RetroFE"
	
	
;Acquiring Dat and Sys Information
	frontendGamesDb := frontendPath . "\meta\hyperlist\" . systemName  . ".xml"
	frontendSystemDb := frontendPath . "\Collections\Main\Menu.txt"
	frontendSystemIni := frontendPath . "\Collections\" . systemName . "\Settings.conf"
	frontendMainMenuIni := frontendPath . "\Collections\Main\Settings.conf"

	
;Acquiring RetroFE media paths
;	frontendSystemIni := frontendPath . "\Collections\" .systemName . "\Settings.conf"
;	Loop, read, %frontendSystemIni%
;	{	Loop, parse, A_LoopReadLine, %A_Tab%
;		{ 	IfInString, A_LoopField, media.screenshot
;			{	fe_screenshot_path = % SubStr(A_LoopField, InStr(A_LoopField, "=") + 1)
;			}	
;		 	Else IfInString, A_LoopField, media.screentitle
;			{	fe_screentitle_path = % SubStr(A_LoopField, InStr(A_LoopField, "=") + 1)
;			}	
;		
;		 	Else IfInString, A_LoopField, media.artwork_back
;			{	fe_artback_path = % SubStr(A_LoopField, InStr(A_LoopField, "=") + 1)
;			}	
;		 	IfInString, A_LoopField, media.artwork_front
;			{	fe_artfront_path = % SubStr(A_LoopField, InStr(A_LoopField, "=") + 1)
;			}	
;		
;			IfInString, A_LoopField, media.logo
;			{	fe_logo_path = % SubStr(A_LoopField, InStr(A_LoopField, "=") + 1)	
;			}	
;		
;		 	IfInString, A_LoopField, media.medium_back
;			{	fe_medback_path = % SubStr(A_LoopField, InStr(A_LoopField, "=") + 1)
;			}	
;		
;		 	IfInString, A_LoopField, media.medium_front
;			{	fe_medfront_path = % SubStr(A_LoopField, InStr(A_LoopField, "=") + 1)
;			}	
;		
;		 	IfInString, A_LoopField, media.video
;			{	fe_video_path = % SubStr(A_LoopField, InStr(A_LoopField, "=") + 1)
;			}		
;		}
;	}
;	
; Game Info (not required)
	;format: gameInfo["Label"] := "Value"
	frontendDatabaseFields := "Description|Cloneof|Manufacturer|Year|Genre|Rating"
	frontendDatabaseLabels := "Name|Cloneof|Manufacturer|Year|Genre|Rating"
	gameInfo := Object()
	gameInfo := BuildDatabaseTable(dbName,systemName,frontendDatabaseFields,frontendDatabaseLabels)
	
	
;----------Loading FrontEnd asset labels
	feLogoLabels:= RIniLoadVar(8,9, "RetroFE", "Fe_Logo_Labels", "Game Logo|System Logo")   ; if label "keepFileName" the filename will be used as label
	feArtworkLabels:= RIniLoadVar(8,9, "RetroFE", "Fe_Artwork_Labels", "Box Art|Cartridge|Flyers|Letters|Other")
	feBackgroundsLabels:= RIniLoadVar(8,9, "RetroFE", "Fe_Backgrounds_Labels", "")
	feControllerLabels:= RIniLoadVar(8,9, "RetroFE", "Fe_Controller_Labels", "")
	feGuidesLabels:= RIniLoadVar(8,9, "RetroFE", "Fe_Guides_Labels", "")
	feManualsLabels:= RIniLoadVar(8,9, "RetroFE", "Fe_Manuals_Labels", "")
	feVideosLabels:= RIniLoadVar(8,9, "RetroFE", "Fe_Videos_Labels", "VIDEOS")
	feDiscArtworkLabel:= RIniLoadVar(8,9, "RetroFE", "Fe_Disc_Artwork_Label", "Artwork1")

	
	
;----------Acquiring Logos
	feLogoLabels := BuildAssetsTable(Fe_Logo_Labels . "\" . dbName,feLogoLabels,"game","png,jpg")

;----------Acquiring ArtWork
	feMedia.Artwork := BuildAssetsTable(Fe_Artwork_Labels . "\" . dbName,feLogoLabels,"game","png,jpg")
	
;----------Acquiring Videos
	feMedia.Videos := BuildAssetsTable(Fe_Videos_Labels . "\" . dbName,feLogoLabels,"game","mp4,flv")
	
Return

BuildDatabaseTable(game,system,ByRef frontendDatabaseFields, ByRef frontendDatabaseLabels){ ; required for rom mapping menu name
	Log("BuildDatabaseTable - Started - Building Table for: " . frontendDatabaseLabels,4)
	Global frontendPath, logLevel
	infoObject := Object()
	stringSplit, label, frontendDatabaseLabels, |
	systemXML := CheckFile( frontendPath . "\meta\hyperlist\" . system . ".xml")
	FileRead, xmlContents, %systemXML%
	; Replacing XML invalid characters
	StringReplace, DatabaseSearchName, game, \, \\, All
	replace :=   {"&":"&","'":"'",".":"\.","*":"\*","?":"\?","+":"\+","[":"\[","{":"\{","|":"\|","(":"\(",")":"\)","^":"\^","$":"\$"}	; replace all characters that will error in a regexmatch
	For what, with in replace
		StringReplace, DatabaseSearchName, DatabaseSearchName, %what%, %with%, All
	; Searching for game on xml
	FoundPos1 := RegExMatch(xmlContents, "i)" . """" . DatabaseSearchName . """", SearchString1)
	Log("BuildDatabaseTable - Searching for a ""Game Name"" in the database",4)
	If !FoundPos1 {	; no info found, setting name info to the game value
		currentobj:={}
		currentobj.Label := "Name"
		currentobj.Value := game
		infoObject.Insert(currentobj["Label"], currentobj)
		Log("BuildDatabaseTable - Ended - no ""Game Name"" found. Assigning """ . game . """ to the label ""Name""",2)
		Return infoObject
	} Else
		Log("BuildDatabaseTable - Found ""Game Name"" in the database!",4)
	; game xml info
	RegExMatch(xmlContents, "i)</game>", SearchString2, FoundPos1)
	GameXMLInfo := StrX(xmlContents,SearchString1,1,0,SearchString2,1,0)	; full game section from HS xml
	loop, parse, frontendDatabaseFields,|, 
	{	currentLabel := label%A_index%
		Log("BuildDatabaseTable - Searching database for: " . currentLabel,4)
		FoundPos1 := RegExMatch(GameXMLInfo, "i)<" . A_Loopfield . ">", SearchString1) ; get start of each xml open tag
		FoundPos2 := RegExMatch(GameXMLInfo, "i)</" . A_Loopfield . ">", SearchString2) ; get start of each xml close tag
		FinalPos1 := FoundPos1 + StrLen(SearchString1)	; store start position and length of field data
		If (FinalPos1 = FoundPos2) {	; if start and end are the same (no data)
			Log("BuildDatabaseTable - Could not find: " . currentLabel,4)
		} Else {	; found some field data
			RegExMatch(GameXMLInfo, "i)</" . A_Loopfield . ">", SearchString2, FoundPos1)	; starting at FoundPos1, 
			XMLDbInfo := StrX(GameXMLInfo,SearchString1,1,StrLen(SearchString1),SearchString2,1,StrLen(SearchString2))
			StringReplace, XMLDbInfo, XMLDbInfo, &, &, All	; replace all & with &
			StringReplace, XMLDbInfo, XMLDbInfo, &apos;, ', All	; replace all &apos; with '
			XMLDbInfo := RegexReplace( XMLDbInfo, "^\s+|\s+$" )
			currentobj:={}
			currentobj.Label := currentLabel
			currentobj.Value := XMLDbInfo
			infoObject.Insert(currentobj["Label"], currentobj)
			Log("BuildDatabaseTable - Found """ . currentLabel . """ with a value: """ . XMLDbInfo . """",4)
		}
	}
	if (logLevel>=5){
		for index, element in infoObject
			gameInfoLog := % gameInfoLog . "`r`n`t`t`t`t`tGameInfo Label: " . element.Label . " | GameInfo Value: " . element.Value
		Log("PluginInit - GameInfo:" gameInfoLog ,5)
	}
	Log("BuildDatabaseTable - Ended",4)
	Return infoObject
}

	frontendPluginInit := 1	; used to keep track if the FE plugin was initialized already
	Log("PluginInit - Ended")
	

ReadFEGameInfo:
	Log("ReadFEGameInfo - Started")
	readFEGameInfo := 1	; used to keep track if the FE game info was read already
	Log("ReadFEGameInfo - Ended")
Return

I couldnt figure out the media assets, nor was I able to have Rocketlauncher pull from the ini for the file paths, it works with ahk msgboxs but not rocket launcher. go fig... from reading up it looks like an issue with the ini/conf encoding format.

Edit: I goofed on this and posted an incomplete plugin script. I apologize for anyone who tried this and didnt have it work. I know no one has commented on this but if someone knows a work around to convert UTF-8 to the proper format, please let me know ^^
 
Last edited:
Top