Thread: Launchbox plugin not pulling media correctly

Results 1 to 20 of 20
  1. Collapse Details
    Launchbox plugin not pulling media correctly 
    #1
    Junior Member
    MainSecondary
    Join Date
    Jan 2016
    Posts
    1
    Contribute If you enjoy reading the
    content here, click the below
    image to support our site.
    Click Here To Contribute To Our Site
    Question
    I checked around and didn't see anyone post about this yet...so I came across an issue with half of my Launchbox clear logos not showing on my fade. For example, I was trying to get "007: Quantum of Solace" to show its clear logo on the fade. I took a look at the RL troubleshooting log and it showed:

    Code:
    BuildAssetsTable - Searching for a Game Logo: D:\Gaming\LaunchBox\Images\Sony Playstation 2\Clear Logo\007: Quantum of Solace.*
    Which is what I expected it to do. But further down the results it was not finding any images by that and instead setting the game name to the rom name (which no media in Launchbox is named that way). I took a look for myself to in the folder it was checking and I found the image was named: 007_ Quantum of Solace-01.png. Since Windows does allow certain special characters in file names, the Launchbox scraper will name it the library game name but replace any special characters with a underscore, which I found out here: https://forums.launchbox-app.com/top...a-file-naming/

    From what Jason was saying, it doesn't sound like there's anyway to get the scraper to just use the rom file name for it's media (which is extremely unfortunate). SOOO my question is, is there any way to have the Launchbox plugin use some sort of regex to replace any incompatible windows file name characters to be underscores as an additional search type when searching for a game's media?
     

  2. Collapse Details
    Re: Launchbox plugin not pulling media correctly 
    #2
    Junior Member

    MainSecondary
    Join Date
    May 2015
    Posts
    26
    Hi,

    I've noticed the same with my LB + RL setup... did you ever work out how to get around this issue?
     

  3. Collapse Details
    Re: Launchbox plugin not pulling media correctly 
    #3
    Junior Member
    MainSecondary
    Join Date
    May 2015
    Posts
    21
    Rename the images to the rom name and it should be fine. I used bulk rename utility to remove -01 at the end of every file, then I used hypertools to rename all the images according to that system's hyperspin database file. Delete cache folder from launchbox, voila.
     

  4. Collapse Details
    Re: Launchbox plugin not pulling media correctly 
    #4
    Junior Member

    MainSecondary
    Join Date
    May 2015
    Posts
    26
    That sounds involved... Would need to be done after every recrape and does it impact the artwork shown in LB?

    Does anyone know if the LaunchBox.plugin file is the correct place to play around with how RL imports LB data?
     

  5. Collapse Details
    Re: Launchbox plugin not pulling media correctly 
    #5
    Junior Member

    MainSecondary
    Join Date
    May 2015
    Posts
    26
    I have edited LaunchBox.plugin to display artwork and descriptions for games with invalid characters.
    It runs a regex search to replace ' and : with an _
    Game name in Pause will show the name with underscores.
    Also, this script will not search artwork subfolders which LB uses (eg for different regions).

    *See post below
    Last edited by teeedubb ; 12-23-2017 at 05:00 PM.
     

  6. Collapse Details
    Re: Launchbox plugin not pulling media correctly 
    #6
    Member kmoney2315's Avatar
    MainSecondary
    Join Date
    Dec 2014
    Posts
    59
    Quote Originally Posted by teeedubb View Post
    I have edited LaunchBox.plugin to display artwork and descriptions for games with invalid characters.
    It runs a regex search to replace ' and : with an _
    Game name in Pause will show the name with underscores.
    Also, this script will not search artwork subfolders which LB uses (eg for different regions).
    Use this script to make RL/Pause use data from LB.

    Code:
    MCRC := "522BEDFD"
    MVersion := "1.0.3"
    
    ; LaunchBox Plugin (by bleasby)
    ; Requires at least LaunchBox version 6.10
    #MaxMem 256
    
    PluginInit:
    	Log("PluginInit - Started")
    
    	;---- FrontEnd Information
    	frontendPlugin := "LaunchBox" 
    	frontendPID := Process("Exist","LaunchBox.exe") ? Process("Exist","LaunchBox.exe") : Process("Exist","BigBox.exe")
    	WinGet, windowIDList, list, Ahk_pid %frontendPID% 
    	loop, % windowIDList
    	{	WinGetTitle, frontendWinTitle, % "Ahk_id " . windowIDList%a_index%
    		if (InStr(frontendWinTitle, "LaunchBox Premium")) or (InStr(frontendWinTitle, "LaunchBox Games Database")) or (InStr(frontendWinTitle, "LaunchBox Big Box")){
    			WinGetClass, frontendWinClass, % "Ahk_id " . windowIDList%a_index%
    			break
    		}
    	}
    	
    	;---- Game Info
    	frontendDatabaseFields := "Developer|Notes|Platform|Publisher|Rating|ReleaseDate|StarRating|Title|Version|Series|PlayMode|Genre|Status|Source|Region|Favorite|Completed|Portable|Clone"
    	frontendDatabaseLabels := "Developer|Description|Platform|Publisher|Rating|Year|StarRating|Name|CloneOf|Series|PlayMode|Genre|Status|Source|Region|Favorite|Completed|Portable|CloneOf"
    	gameInfo := Object()
    	gameInfo := BuildDatabaseTable(dbName,systemName,frontendDatabaseFields,frontendDatabaseLabels)
    	
    	;----------Loading FrontEnd asset labels
    	feMedia := {}
    	feLogoLabels:= RIniLoadVar("GlobalPluginsIni","SystemPluginsIni", "LaunchBox", "Fe_Logo_Labels", "Game Logo|System Logo")   ; if label "keepFileName" the filename will be used as label
    	feBackgroundsLabels:= RIniLoadVar("GlobalPluginsIni","SystemPluginsIni", "LaunchBox", "Fe_Backgrounds_Labels", "Background|Fanart - Background")
    	feDiscArtworkLabel:= RIniLoadVar("GlobalPluginsIni","SystemPluginsIni", "LaunchBox", "Fe_Disc_Artwork_Label", "")
    	
    	;Acquiring Logos
    	logoPath := frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Clear Logo"
    	systemLogoPath := frontendPath . "\Images\Platforms\" . gameInfo["Platform"].Value . "\Clear Logo"
    	feMedia.Logos := launchboxProcessExtraFiles(logoPath . "|" . systemLogoPath, feLogoLabels, "game|system", "png|bmp|gif|jpg|tif")
    	
    	;Acquiring Backgrounds 
    	gameBackgroundsPath := frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Fanart - Background\Background"
    	gameFanartBackgroundPath := frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Fanart - Background"
    	feMedia.Backgrounds := launchboxProcessExtraFiles(gameBackgroundsPath . "|" . gameFanartBackgroundPath,feBackgroundsLabels,"game|game","png|bmp|gif|jpg|tif")
    
    	;Acquiring Disc artwork (not available or location unknown on LaunchBox folders)
    
    	Log("PluginInit - Ended")
    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, dbName, romPath, romExtension, RLObject
    	infoObject := Object()
    	stringSplit, label, frontendDatabaseLabels, |
    	systemXML := CheckFile(frontendPath . "\Data\Platforms\" . system . ".xml")
    	FileRead, xmlContents, %systemXML%
    	;search for a relative game path in relation with launchbox if the game is on the same drive as Launchbox (required because the way Launchbox saves the ApplicationPath info)
    	if (substr(frontendPath,1,1) = substr(romPath . "\" . dbName . romExtension, 1, 1))
    		searchStringStart := RLObject.getRelativePathFromFull(frontendPath, romPath . "\" . dbName . romExtension)
    	else
    		searchStringStart := romPath . "\" . dbName . romExtension
    	; Replacing XML invalid characters
    	replace :=   {"&":"&"}
    	;replace :=   {"&":"&","'":"'","<":"<",">":">","""":"""} ; there is no need for replacing other invalid xml characters either because they are invalid file names or because LaunchBox does not replace them on its databases
    	For what, with in replace
    		StringReplace, searchStringStart, searchStringStart, %what%, %with%, All
    	searchStringStart := "<ApplicationPath>" . searchStringStart . "</ApplicationPath>"	
    	Log("BuildDatabaseTable - Searching LaunchBox database file for XML section: " . searchStringStart,4)
    	searchStringEnd := "</Game>"
    	GameXMLInfo := StrX(xmlContents,searchStringStart,1,0,searchStringEnd,1,0)	; full game section from HS xml
    	if !(GameXMLInfo) { ; 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
    	loop, parse, frontendDatabaseFields,|, 
    	{	currentLabel := label%A_index%
    		Log("BuildDatabaseTable - Looking database for: " . currentLabel,4)
    		XMLDbInfo := StrX(GameXMLInfo,"<" . A_Loopfield . ">",1,StrLen("<" . A_Loopfield . ">"),"</" . A_Loopfield . ">"d,1,StrLen("</" . A_Loopfield . ">"))
    		XMLDbInfo := RegexReplace( XMLDbInfo, "^\s+|\s+$" )
    		;post processing some of the LaunchBox database info
    		if (currentLabel="Year")
    			XMLDbInfo :=  SubStr(XMLDbInfo,1,4)
    		currentobj:={}
    		currentobj.Label := currentLabel
    		currentobj.Value := XMLDbInfo
    		infoObject.Insert(currentobj["Label"], currentobj)
    		if (XMLDbInfo)
    			Log("BuildDatabaseTable - Found """ . currentLabel . """ with a value: """ . XMLDbInfo . """",4)
    	}
    	;platform info
    	if (infoObject["Platform"].Value){
    		searchStringStart := "<Name>" . infoObject["Platform"].Value . "</Name>"
    		searchStringEnd := "</Platform>"
    		platformPathInfo := StrX(xmlContents,searchStringStart,1,0,searchStringEnd,1,0)
    		mediaFoldersXMLKeys := "VideosFolder|FrontImagesFolder|BackImagesFolder|ClearLogoImagesFolder|FanartImagesFolder|ScreenshotImagesFolder|BannerImagesFolder|SteamBannerImagesFolder|ManualsFolder|MusicFolder"
    		mediaFoldersLabels := "Videos_Path|Front_Path|Back_Path|ClearLogo_Path|Fanart_Path|Screenshot_Path|Banner_Path|SteamBanner_Path|Manuals_Path|Music_Path"
    		stringSplit, label, mediaFoldersLabels, |
    		loop, parse, mediaFoldersXMLKeys,|, 
    		{	currentLabel := label%A_index%
    			Log("BuildDatabaseTable - Looking database for platform path for: " . currentLabel,4)
    			XMLDbInfo := StrX(platformPathInfo,"<" . A_Loopfield . ">",1,StrLen("<" . A_Loopfield . ">"),"</" . A_Loopfield . ">"d,1,StrLen("</" . A_Loopfield . ">"))
    			currentobj:={}
    			currentobj.Label := currentLabel
    			currentobj.Value := XMLDbInfo
    			infoObject.Insert(currentobj["Label"], currentobj)
    			if (XMLDbInfo)
    				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
    }
    
    launchboxProcessExtraFiles(list,label,AssetType,extensions){
    	Global gameInfo, romName
    	obj := {}
    	StringSplit, labelArray, label, |,
    	StringSplit, AssetTypeArray, AssetType, |,
    	Loop, Parse, list,|
    	{ 	currentLabel := A_Index
    		If !(labelArray%currentLabel% = "#disabled#"){	
    			If (AssetTypeArray%currentLabel% = "game"){
    				;adding dbnamed assets
    
    romName := RegexReplace( romName, "'", "_" )
    romName := RegexReplace( romName, ":", "_" )
    gameInfo["Name"].Value := RegexReplace( gameInfo["Name"].Value, "'", "_" )
    gameInfo["Name"].Value := RegexReplace( gameInfo["Name"].Value, ":", "_" )
    
    				obj := BuildAssetsTable(A_loopfield . "\" . gameInfo["Name"].Value . ".*",labelArray%currentLabel%,AssetTypeArray%currentLabel%,extensions, obj)
    				Loop, 9
    					obj := BuildAssetsTable(A_loopfield . "\" . gameInfo["Name"].Value . "-0" . a_index . ".*",labelArray%currentLabel% . "-0" . a_index,AssetTypeArray%currentLabel%,extensions, obj)
    				if (parentDbName){
    					obj := BuildAssetsTable(A_loopfield . "\" . gameInfo["CloneOf"].Value . ".*","Parent " . labelArray%currentLabel%,AssetTypeArray%currentLabel%,extensions, obj)
    					Loop, 9
    						obj := BuildAssetsTable(A_loopfield . "\" . gameInfo["CloneOf"].Value . "-0" . a_index . ".*","Parent " . labelArray%currentLabel% . "-0" . a_index,AssetTypeArray%currentLabel%,extensions, obj)
    				}
    				;adding rom named assets
    				obj := BuildAssetsTable(A_loopfield . "\" . romName . ".*","Rom " . labelArray%currentLabel%,AssetTypeArray%currentLabel%,extensions, obj)
    				Loop, 9
    					obj := BuildAssetsTable(A_loopfield . "\" . romName . "-0" . a_index . ".*","Rom " . labelArray%currentLabel% . "-0" . a_index,AssetTypeArray%currentLabel%,extensions, obj)
    			} else { ;system assets
    				obj := BuildAssetsTable(A_loopfield . "\" . gameInfo["Platform"].Value . ".*",labelArray%currentLabel%,AssetTypeArray%currentLabel%,extensions, obj)
    				Loop, 9
    					obj := BuildAssetsTable(A_loopfield . "\" . gameInfo["Platform"].Value . "-0" . a_index . ".*",labelArray%currentLabel% . "-0" . a_index,AssetTypeArray%currentLabel%,extensions, obj)
    			}
    		}
    	}
    	Return obj
    }
    
    loadAdditionalFEAssets(){
    	Global additionalFEAssetsLoaded, feMedia, frontendPath, gameInfo
    
    	;Loading labels from ini files
    	feArtworkLabels:= RIniLoadVar("GlobalPluginsIni","SystemPluginsIni", "LaunchBox", "Fe_Artwork_Labels", "Advertisement Flyer - Back|Advertisement Flyer - Front|Arcade - Cabinet|Arcade - Circuit Board|Arcade - Control Panel|Arcade - Controls Information|Arcade - Marquee|Banner|Box - 3D|Box - Back|Box - Back - Reconstructed|Box - Front|Box - Front - Reconstructed|Cart - 3D|Cart - Back|Cart - Front|Disc|Fanart - Box - Back|Fanart - Box - Front|Fanart - Cart - Back|Fanart - Cart - Front|Fanart - Disc|Screenshot - Game Over|Screenshot - Game Select|Screenshot - Game Title|Screenshot - Gameplay|Screenshot - High Scores|Steam Banner|Screenshot - Gameplay - Cabinet|Screenshot - Gameplay - Controls|Screenshot - Gameplay - CP|Screenshot - Gameplay - GameOver|Screenshot - Gameplay - Marquee|Screenshot - Gameplay - PCB|Screenshot - Gameplay - Score|Screenshot - Gameplay - Select|Screenshot - Gameplay - Snap|Screenshot - Gameplay - Title")
    	feControllerLabels:= RIniLoadVar("GlobalPluginsIni","SystemPluginsIni", "LaunchBox", "Fe_Controller_Labels", "")
    	feGuidesLabels:= RIniLoadVar("GlobalPluginsIni","SystemPluginsIni", "LaunchBox", "Fe_Guides_Labels", "")
    	feManualsLabels:= RIniLoadVar("GlobalPluginsIni","SystemPluginsIni", "LaunchBox", "Fe_Manuals_Labels", "Game Manual")
    	feVideosLabels:= RIniLoadVar("GlobalPluginsIni","SystemPluginsIni", "LaunchBox", "Fe_Videos_Labels", "Game Video|System Video")
    	
    	;Acquiring ArtWork
    	feArtworkPaths1 := frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Advertisement Flyer - Back" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Advertisement Flyer - Front" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Arcade - Cabinet" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Arcade - Circuit Board" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Arcade - Control Panel" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Arcade - Controls Information" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Arcade - Marquee" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Banner" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Box - 3D" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Box - Back" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Box - Back - Reconstructed" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Box - Front" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Box - Front - Reconstructed" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Cart - 3D" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Cart - Back" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Cart - Front" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Disc"
    	feArtworkPaths2 := frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Fanart - Box - Back" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Fanart - Box - Front" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Fanart - Cart - Back" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Fanart - Cart - Front" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Fanart - Disc" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - Game Over" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - Game Select" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - Game Title" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - Gameplay" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - High Scores" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Steam Banner" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - Gameplay\Cabinet" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - Gameplay\Controls" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - Gameplay\CP" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - Gameplay\GameOver" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - Gameplay\Marquee" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - Gameplay\PCB" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - Gameplay\Score" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - Gameplay\Select" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - Gameplay\Snap" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - Gameplay\Title" 
    	feMedia.Artwork := launchboxProcessExtraFiles(feArtworkPaths1 . "|" . feArtworkPaths2, feArtworkLabels, "game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game", "png|bmp|gif|jpg|tif")
    
    	;Acquiring Videos
    	gameVideoPath := frontendPath . "\Videos\" . gameInfo["Platform"].Value
    	systemVideoPath := frontendPath . "\Videos\Platforms\" . gameInfo["Platform"].Value
    	feMedia.Videos := launchboxProcessExtraFiles(gameVideoPath . "|" . systemVideoPath,feVideosLabels,"game|system","mp4,flv")
    	
    	;Acquiring Manuals
    	gameManualPath := frontendPath . "\Manuals\" . gameInfo["Platform"].Value
    	feMedia.Manuals := launchboxProcessExtraFiles(gameManualPath,feManualsLabels,"game","pdf")
    
    	;Acquiring Controller (not available or location unknown on LaunchBox folders)
    	;Acquiring Guides (not available or location unknown on LaunchBox folders)
    	
    	additionalFEAssetsLoaded := true
    	Return
    }
    The plugin is working great with your added modifications. I was having to rename all my images that had _ in the box art or videos but with this added I don't have to.Thanks for sharing.
     

  7. Collapse Details
    Re: Launchbox plugin not pulling media correctly 
    #7
    Junior Member

    MainSecondary
    Join Date
    May 2015
    Posts
    26
    Thanks for testing. New version below which swaps &amp; for &
    If you find anyother characters that need to be cleansed let me know and Ill add it to the plugin.

    Code:
    MCRC := "522BEDFD"
    MVersion := "1.0.3"
    
    ; LaunchBox Plugin (by bleasby)
    ; Requires at least LaunchBox version 6.10
    #MaxMem 256
    
    PluginInit:
    	Log("PluginInit - Started")
    
    	;---- FrontEnd Information
    	frontendPlugin := "LaunchBox" 
    	frontendPID := Process("Exist","LaunchBox.exe") ? Process("Exist","LaunchBox.exe") : Process("Exist","BigBox.exe")
    	WinGet, windowIDList, list, Ahk_pid %frontendPID% 
    	loop, % windowIDList
    	{	WinGetTitle, frontendWinTitle, % "Ahk_id " . windowIDList%a_index%
    		if (InStr(frontendWinTitle, "LaunchBox Premium")) or (InStr(frontendWinTitle, "LaunchBox Games Database")) or (InStr(frontendWinTitle, "LaunchBox Big Box")){
    			WinGetClass, frontendWinClass, % "Ahk_id " . windowIDList%a_index%
    			break
    		}
    	}
    	
    	;---- Game Info
    	frontendDatabaseFields := "Developer|Notes|Platform|Publisher|Rating|ReleaseDate|StarRating|Title|Version|Series|PlayMode|Genre|Status|Source|Region|Favorite|Completed|Portable|Clone"
    	frontendDatabaseLabels := "Developer|Description|Platform|Publisher|Rating|Year|StarRating|Name|CloneOf|Series|PlayMode|Genre|Status|Source|Region|Favorite|Completed|Portable|CloneOf"
    	gameInfo := Object()
    	gameInfo := BuildDatabaseTable(dbName,systemName,frontendDatabaseFields,frontendDatabaseLabels)
    	
    	;----------Loading FrontEnd asset labels
    	feMedia := {}
    	feLogoLabels:= RIniLoadVar("GlobalPluginsIni","SystemPluginsIni", "LaunchBox", "Fe_Logo_Labels", "Game Logo|System Logo")   ; if label "keepFileName" the filename will be used as label
    	feBackgroundsLabels:= RIniLoadVar("GlobalPluginsIni","SystemPluginsIni", "LaunchBox", "Fe_Backgrounds_Labels", "Background|Fanart - Background")
    	feDiscArtworkLabel:= RIniLoadVar("GlobalPluginsIni","SystemPluginsIni", "LaunchBox", "Fe_Disc_Artwork_Label", "")
    	
    	;Acquiring Logos
    	logoPath := frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Clear Logo"
    	systemLogoPath := frontendPath . "\Images\Platforms\" . gameInfo["Platform"].Value . "\Clear Logo"
    	feMedia.Logos := launchboxProcessExtraFiles(logoPath . "|" . systemLogoPath, feLogoLabels, "game|system", "png|bmp|gif|jpg|tif")
    	
    	;Acquiring Backgrounds 
    	gameBackgroundsPath := frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Fanart - Background\Background"
    	gameFanartBackgroundPath := frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Fanart - Background"
    	feMedia.Backgrounds := launchboxProcessExtraFiles(gameBackgroundsPath . "|" . gameFanartBackgroundPath,feBackgroundsLabels,"game|game","png|bmp|gif|jpg|tif")
    
    	;Acquiring Disc artwork (not available or location unknown on LaunchBox folders)
    
    	Log("PluginInit - Ended")
    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, dbName, romPath, romExtension, RLObject
    	infoObject := Object()
    	stringSplit, label, frontendDatabaseLabels, |
    	systemXML := CheckFile(frontendPath . "\Data\Platforms\" . system . ".xml")
    	FileRead, xmlContents, %systemXML%
    	;search for a relative game path in relation with launchbox if the game is on the same drive as Launchbox (required because the way Launchbox saves the ApplicationPath info)
    	if (substr(frontendPath,1,1) = substr(romPath . "\" . dbName . romExtension, 1, 1))
    		searchStringStart := RLObject.getRelativePathFromFull(frontendPath, romPath . "\" . dbName . romExtension)
    	else
    		searchStringStart := romPath . "\" . dbName . romExtension
    	; Replacing XML invalid characters
    	replace :=   {"&":"&amp;"}
    	;replace :=   {"&":"&amp;","'":"&apos;","<":"&lt;",">":"&gt;","""":"&quot;"} ; there is no need for replacing other invalid xml characters either because they are invalid file names or because LaunchBox does not replace them on its databases
    	For what, with in replace
    		StringReplace, searchStringStart, searchStringStart, %what%, %with%, All
    	searchStringStart := "<ApplicationPath>" . searchStringStart . "</ApplicationPath>"	
    	Log("BuildDatabaseTable - Searching LaunchBox database file for XML section: " . searchStringStart,4)
    	searchStringEnd := "</Game>"
    	GameXMLInfo := StrX(xmlContents,searchStringStart,1,0,searchStringEnd,1,0)	; full game section from HS xml
    	if !(GameXMLInfo) { ; 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
    	loop, parse, frontendDatabaseFields,|, 
    	{	currentLabel := label%A_index%
    		Log("BuildDatabaseTable - Looking database for: " . currentLabel,4)
    		XMLDbInfo := StrX(GameXMLInfo,"<" . A_Loopfield . ">",1,StrLen("<" . A_Loopfield . ">"),"</" . A_Loopfield . ">"d,1,StrLen("</" . A_Loopfield . ">"))
    		XMLDbInfo := RegexReplace( XMLDbInfo, "^\s+|\s+$" )
    		;post processing some of the LaunchBox database info
    		if (currentLabel="Year")
    			XMLDbInfo :=  SubStr(XMLDbInfo,1,4)
    		currentobj:={}
    		currentobj.Label := currentLabel
    		currentobj.Value := XMLDbInfo
    		infoObject.Insert(currentobj["Label"], currentobj)
    		if (XMLDbInfo)
    			Log("BuildDatabaseTable - Found """ . currentLabel . """ with a value: """ . XMLDbInfo . """",4)
    	}
    	;platform info
    	if (infoObject["Platform"].Value){
    		searchStringStart := "<Name>" . infoObject["Platform"].Value . "</Name>"
    		searchStringEnd := "</Platform>"
    		platformPathInfo := StrX(xmlContents,searchStringStart,1,0,searchStringEnd,1,0)
    		mediaFoldersXMLKeys := "VideosFolder|FrontImagesFolder|BackImagesFolder|ClearLogoImagesFolder|FanartImagesFolder|ScreenshotImagesFolder|BannerImagesFolder|SteamBannerImagesFolder|ManualsFolder|MusicFolder"
    		mediaFoldersLabels := "Videos_Path|Front_Path|Back_Path|ClearLogo_Path|Fanart_Path|Screenshot_Path|Banner_Path|SteamBanner_Path|Manuals_Path|Music_Path"
    		stringSplit, label, mediaFoldersLabels, |
    		loop, parse, mediaFoldersXMLKeys,|, 
    		{	currentLabel := label%A_index%
    			Log("BuildDatabaseTable - Looking database for platform path for: " . currentLabel,4)
    			XMLDbInfo := StrX(platformPathInfo,"<" . A_Loopfield . ">",1,StrLen("<" . A_Loopfield . ">"),"</" . A_Loopfield . ">"d,1,StrLen("</" . A_Loopfield . ">"))
    			currentobj:={}
    			currentobj.Label := currentLabel
    			currentobj.Value := XMLDbInfo
    			infoObject.Insert(currentobj["Label"], currentobj)
    			if (XMLDbInfo)
    				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
    }
    
    launchboxProcessExtraFiles(list,label,AssetType,extensions){
    	Global gameInfo, romName
    	obj := {}
    	StringSplit, labelArray, label, |,
    	StringSplit, AssetTypeArray, AssetType, |,
    	Loop, Parse, list,|
    	{ 	currentLabel := A_Index
    		If !(labelArray%currentLabel% = "#disabled#"){	
    			If (AssetTypeArray%currentLabel% = "game"){
    				;adding dbnamed assets
    
    romName := RegexReplace( romName, "'", "_" )
    romName := RegexReplace( romName, ":", "_" )
    romName := RegexReplace( romName, "&amp;", "&" )
    gameInfo["Name"].Value := RegexReplace( gameInfo["Name"].Value, "'", "_" )
    gameInfo["Name"].Value := RegexReplace( gameInfo["Name"].Value, ":", "_" )
    gameInfo["Name"].Value := RegexReplace( gameInfo["Name"].Value, "&amp;", "&" )
    
    				obj := BuildAssetsTable(A_loopfield . "\" . gameInfo["Name"].Value . ".*",labelArray%currentLabel%,AssetTypeArray%currentLabel%,extensions, obj)
    				Loop, 9
    					obj := BuildAssetsTable(A_loopfield . "\" . gameInfo["Name"].Value . "-0" . a_index . ".*",labelArray%currentLabel% . "-0" . a_index,AssetTypeArray%currentLabel%,extensions, obj)
    				if (parentDbName){
    					obj := BuildAssetsTable(A_loopfield . "\" . gameInfo["CloneOf"].Value . ".*","Parent " . labelArray%currentLabel%,AssetTypeArray%currentLabel%,extensions, obj)
    					Loop, 9
    						obj := BuildAssetsTable(A_loopfield . "\" . gameInfo["CloneOf"].Value . "-0" . a_index . ".*","Parent " . labelArray%currentLabel% . "-0" . a_index,AssetTypeArray%currentLabel%,extensions, obj)
    				}
    				;adding rom named assets
    				obj := BuildAssetsTable(A_loopfield . "\" . romName . ".*","Rom " . labelArray%currentLabel%,AssetTypeArray%currentLabel%,extensions, obj)
    				Loop, 9
    					obj := BuildAssetsTable(A_loopfield . "\" . romName . "-0" . a_index . ".*","Rom " . labelArray%currentLabel% . "-0" . a_index,AssetTypeArray%currentLabel%,extensions, obj)
    			} else { ;system assets
    				obj := BuildAssetsTable(A_loopfield . "\" . gameInfo["Platform"].Value . ".*",labelArray%currentLabel%,AssetTypeArray%currentLabel%,extensions, obj)
    				Loop, 9
    					obj := BuildAssetsTable(A_loopfield . "\" . gameInfo["Platform"].Value . "-0" . a_index . ".*",labelArray%currentLabel% . "-0" . a_index,AssetTypeArray%currentLabel%,extensions, obj)
    			}
    		}
    	}
    	Return obj
    }
    
    loadAdditionalFEAssets(){
    	Global additionalFEAssetsLoaded, feMedia, frontendPath, gameInfo
    
    	;Loading labels from ini files
    	feArtworkLabels:= RIniLoadVar("GlobalPluginsIni","SystemPluginsIni", "LaunchBox", "Fe_Artwork_Labels", "Advertisement Flyer - Back|Advertisement Flyer - Front|Arcade - Cabinet|Arcade - Circuit Board|Arcade - Control Panel|Arcade - Controls Information|Arcade - Marquee|Banner|Box - 3D|Box - Back|Box - Back - Reconstructed|Box - Front|Box - Front - Reconstructed|Cart - 3D|Cart - Back|Cart - Front|Disc|Fanart - Box - Back|Fanart - Box - Front|Fanart - Cart - Back|Fanart - Cart - Front|Fanart - Disc|Screenshot - Game Over|Screenshot - Game Select|Screenshot - Game Title|Screenshot - Gameplay|Screenshot - High Scores|Steam Banner|Screenshot - Gameplay - Cabinet|Screenshot - Gameplay - Controls|Screenshot - Gameplay - CP|Screenshot - Gameplay - GameOver|Screenshot - Gameplay - Marquee|Screenshot - Gameplay - PCB|Screenshot - Gameplay - Score|Screenshot - Gameplay - Select|Screenshot - Gameplay - Snap|Screenshot - Gameplay - Title")
    	feControllerLabels:= RIniLoadVar("GlobalPluginsIni","SystemPluginsIni", "LaunchBox", "Fe_Controller_Labels", "")
    	feGuidesLabels:= RIniLoadVar("GlobalPluginsIni","SystemPluginsIni", "LaunchBox", "Fe_Guides_Labels", "")
    	feManualsLabels:= RIniLoadVar("GlobalPluginsIni","SystemPluginsIni", "LaunchBox", "Fe_Manuals_Labels", "Game Manual")
    	feVideosLabels:= RIniLoadVar("GlobalPluginsIni","SystemPluginsIni", "LaunchBox", "Fe_Videos_Labels", "Game Video|System Video")
    	
    	;Acquiring ArtWork
    	feArtworkPaths1 := frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Advertisement Flyer - Back" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Advertisement Flyer - Front" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Arcade - Cabinet" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Arcade - Circuit Board" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Arcade - Control Panel" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Arcade - Controls Information" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Arcade - Marquee" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Banner" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Box - 3D" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Box - Back" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Box - Back - Reconstructed" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Box - Front" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Box - Front - Reconstructed" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Cart - 3D" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Cart - Back" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Cart - Front" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Disc"
    	feArtworkPaths2 := frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Fanart - Box - Back" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Fanart - Box - Front" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Fanart - Cart - Back" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Fanart - Cart - Front" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Fanart - Disc" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - Game Over" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - Game Select" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - Game Title" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - Gameplay" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - High Scores" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Steam Banner" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - Gameplay\Cabinet" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - Gameplay\Controls" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - Gameplay\CP" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - Gameplay\GameOver" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - Gameplay\Marquee" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - Gameplay\PCB" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - Gameplay\Score" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - Gameplay\Select" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - Gameplay\Snap" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - Gameplay\Title" 
    	feMedia.Artwork := launchboxProcessExtraFiles(feArtworkPaths1 . "|" . feArtworkPaths2, feArtworkLabels, "game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game", "png|bmp|gif|jpg|tif")
    
    	;Acquiring Videos
    	gameVideoPath := frontendPath . "\Videos\" . gameInfo["Platform"].Value
    	systemVideoPath := frontendPath . "\Videos\Platforms\" . gameInfo["Platform"].Value
    	feMedia.Videos := launchboxProcessExtraFiles(gameVideoPath . "|" . systemVideoPath,feVideosLabels,"game|system","mp4,flv")
    	
    	;Acquiring Manuals
    	gameManualPath := frontendPath . "\Manuals\" . gameInfo["Platform"].Value
    	feMedia.Manuals := launchboxProcessExtraFiles(gameManualPath,feManualsLabels,"game","pdf")
    
    	;Acquiring Controller (not available or location unknown on LaunchBox folders)
    	;Acquiring Guides (not available or location unknown on LaunchBox folders)
    	
    	additionalFEAssetsLoaded := true
    	Return
    }
     

  8. Collapse Details
    Re: Launchbox plugin not pulling media correctly 
    #8
    Senior Member

    MainSecondary
    Join Date
    Oct 2016
    Posts
    517
    Nice...

    But I deleted the following two lines for my setup:

    gameInfo["Name"].Value := RegexReplace( gameInfo["Name"].Value, "'", "_" )
    gameInfo["Name"].Value := RegexReplace( gameInfo["Name"].Value, ":", "_" )

    I use plain text for my game name, and games like Advanced Dungeons & Dragons: DragonStrike had the &amp; problem fixed, but then had _ in place of : and I can't have that lol.

    Also, I'm pretty sure those edits are unnecessary, because the rom name is what RocketLauncher actually looks for when matching images - the title is just what it displays.

    Thanks for this though... I know nothing about code, I just know enough to tweak things and get by.
     

  9. Collapse Details
    Re: Launchbox plugin not pulling media correctly 
    #9
    Senior Member

    MainSecondary
    Join Date
    Oct 2016
    Posts
    517
    I just discovered that the 'publisher' and 'developer' field also need this code added, teeedubb.

    Here's what I have for my plugin, everything is working well for me. Brolly, this should be the new Launchbox plugin. The &amp; thing really looks bad in fades when it displays your metadata.

    Code:
    MCRC := "522BEDFD"
    MVersion := "1.0.3"
    
    ; LaunchBox Plugin (by bleasby)
    ; Requires at least LaunchBox version 6.10
    #MaxMem 256
    
    PluginInit:
    	Log("PluginInit - Started")
    
    	;---- FrontEnd Information
    	frontendPlugin := "LaunchBox" 
    	frontendPID := Process("Exist","LaunchBox.exe") ? Process("Exist","LaunchBox.exe") : Process("Exist","BigBox.exe")
    	WinGet, windowIDList, list, Ahk_pid %frontendPID% 
    	loop, % windowIDList
    	{	WinGetTitle, frontendWinTitle, % "Ahk_id " . windowIDList%a_index%
    		if (InStr(frontendWinTitle, "LaunchBox Premium")) or (InStr(frontendWinTitle, "LaunchBox Games Database")) or (InStr(frontendWinTitle, "LaunchBox Big Box")){
    			WinGetClass, frontendWinClass, % "Ahk_id " . windowIDList%a_index%
    			break
    		}
    	}
    	
    	;---- Game Info
    	frontendDatabaseFields := "Developer|Notes|Platform|Publisher|Rating|ReleaseDate|StarRating|Title|Version|Series|PlayMode|Genre|Status|Source|Region|Favorite|Completed|Portable|Clone"
    	frontendDatabaseLabels := "Developer|Notes|Platform|Publisher|Rating|Year|StarRating|Name|CloneOf|Series|PlayMode|Genre|Status|Source|Region|Favorite|Completed|Portable|CloneOf"
    	gameInfo := Object()
    	gameInfo := BuildDatabaseTable(dbName,systemName,frontendDatabaseFields,frontendDatabaseLabels)
    	
    	;----------Loading FrontEnd asset labels
    	feMedia := {}
    	feLogoLabels:= RIniLoadVar("GlobalPluginsIni","SystemPluginsIni", "LaunchBox", "Fe_Logo_Labels", "Game Logo|System Logo")   ; if label "keepFileName" the filename will be used as label
    	feBackgroundsLabels:= RIniLoadVar("GlobalPluginsIni","SystemPluginsIni", "LaunchBox", "Fe_Backgrounds_Labels", "Background|Fanart - Background")
    	feDiscArtworkLabel:= RIniLoadVar("GlobalPluginsIni","SystemPluginsIni", "LaunchBox", "Fe_Disc_Artwork_Label", "")
    	
    	;Acquiring Logos
    	logoPath := frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Clear Logo"
    	systemLogoPath := frontendPath . "\Images\Platforms\" . gameInfo["Platform"].Value . "\Clear Logo"
    	feMedia.Logos := launchboxProcessExtraFiles(logoPath . "|" . systemLogoPath, feLogoLabels, "game|system", "png|bmp|gif|jpg|tif")
    	
    	;Acquiring Backgrounds 
    	gameBackgroundsPath := frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Fanart - Background\Background"
    	gameFanartBackgroundPath := frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Fanart - Background"
    	feMedia.Backgrounds := launchboxProcessExtraFiles(gameBackgroundsPath . "|" . gameFanartBackgroundPath,feBackgroundsLabels,"game|game","png|bmp|gif|jpg|tif")
    
    	;Acquiring Disc artwork (not available or location unknown on LaunchBox folders)
    
    	Log("PluginInit - Ended")
    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, dbName, romPath, romExtension, RLObject
    	infoObject := Object()
    	stringSplit, label, frontendDatabaseLabels, |
    	systemXML := CheckFile(frontendPath . "\Data\Platforms\" . system . ".xml")
    	FileRead, xmlContents, %systemXML%
    	;search for a relative game path in relation with launchbox if the game is on the same drive as Launchbox (required because the way Launchbox saves the ApplicationPath info)
    	if (substr(frontendPath,1,1) = substr(romPath . "\" . dbName . romExtension, 1, 1))
    		searchStringStart := RLObject.getRelativePathFromFull(frontendPath, romPath . "\" . dbName . romExtension)
    	else
    		searchStringStart := romPath . "\" . dbName . romExtension
    	; Replacing XML invalid characters
    	replace :=   {"&":"&amp;"}
    	;replace :=   {"&":"&amp;","'":"&apos;","<":"&lt;",">":"&gt;","""":"&quot;"} ; there is no need for replacing other invalid xml characters either because they are invalid file names or because LaunchBox does not replace them on its databases
    	For what, with in replace
    		StringReplace, searchStringStart, searchStringStart, %what%, %with%, All
    	searchStringStart := "<ApplicationPath>" . searchStringStart . "</ApplicationPath>"	
    	Log("BuildDatabaseTable - Searching LaunchBox database file for XML section: " . searchStringStart,4)
    	searchStringEnd := "</Game>"
    	GameXMLInfo := StrX(xmlContents,searchStringStart,1,0,searchStringEnd,1,0)	; full game section from HS xml
    	if !(GameXMLInfo) { ; 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
    	loop, parse, frontendDatabaseFields,|, 
    	{	currentLabel := label%A_index%
    		Log("BuildDatabaseTable - Looking database for: " . currentLabel,4)
    		XMLDbInfo := StrX(GameXMLInfo,"<" . A_Loopfield . ">",1,StrLen("<" . A_Loopfield . ">"),"</" . A_Loopfield . ">"d,1,StrLen("</" . A_Loopfield . ">"))
    		XMLDbInfo := RegexReplace( XMLDbInfo, "^\s+|\s+$" )
    		;post processing some of the LaunchBox database info
    		if (currentLabel="Year")
    			XMLDbInfo :=  SubStr(XMLDbInfo,1,4)
    		currentobj:={}
    		currentobj.Label := currentLabel
    		currentobj.Value := XMLDbInfo
    		infoObject.Insert(currentobj["Label"], currentobj)
    		if (XMLDbInfo)
    			Log("BuildDatabaseTable - Found """ . currentLabel . """ with a value: """ . XMLDbInfo . """",4)
    	}
    	;platform info
    	if (infoObject["Platform"].Value){
    		searchStringStart := "<Name>" . infoObject["Platform"].Value . "</Name>"
    		searchStringEnd := "</Platform>"
    		platformPathInfo := StrX(xmlContents,searchStringStart,1,0,searchStringEnd,1,0)
    		mediaFoldersXMLKeys := "VideosFolder|FrontImagesFolder|BackImagesFolder|ClearLogoImagesFolder|FanartImagesFolder|ScreenshotImagesFolder|BannerImagesFolder|SteamBannerImagesFolder|ManualsFolder|MusicFolder"
    		mediaFoldersLabels := "Videos_Path|Front_Path|Back_Path|ClearLogo_Path|Fanart_Path|Screenshot_Path|Banner_Path|SteamBanner_Path|Manuals_Path|Music_Path"
    		stringSplit, label, mediaFoldersLabels, |
    		loop, parse, mediaFoldersXMLKeys,|, 
    		{	currentLabel := label%A_index%
    			Log("BuildDatabaseTable - Looking database for platform path for: " . currentLabel,4)
    			XMLDbInfo := StrX(platformPathInfo,"<" . A_Loopfield . ">",1,StrLen("<" . A_Loopfield . ">"),"</" . A_Loopfield . ">"d,1,StrLen("</" . A_Loopfield . ">"))
    			currentobj:={}
    			currentobj.Label := currentLabel
    			currentobj.Value := XMLDbInfo
    			infoObject.Insert(currentobj["Label"], currentobj)
    			if (XMLDbInfo)
    				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
    }
    
    launchboxProcessExtraFiles(list,label,AssetType,extensions){
    	Global gameInfo, romName
    	obj := {}
    	StringSplit, labelArray, label, |,
    	StringSplit, AssetTypeArray, AssetType, |,
    	Loop, Parse, list,|
    	{ 	currentLabel := A_Index
    		If !(labelArray%currentLabel% = "#disabled#"){	
    			If (AssetTypeArray%currentLabel% = "game"){
    				;adding dbnamed assets
    											
    romName := RegexReplace( romName, ":", "_" )
    romName := RegexReplace( romName, "&amp;", "&" )
    gameInfo["Name"].Value := RegexReplace( gameInfo["Name"].Value, "&amp;", "&" )
    gameInfo["Developer"].Value := RegexReplace( gameInfo["Developer"].Value, "&amp;", "&" )
    gameInfo["Publisher"].Value := RegexReplace( gameInfo["Publisher"].Value, "&amp;", "&" )																			  
    
    				obj := BuildAssetsTable(A_loopfield . "\" . gameInfo["Name"].Value . ".*",labelArray%currentLabel%,AssetTypeArray%currentLabel%,extensions, obj)
    				Loop, 9
    					obj := BuildAssetsTable(A_loopfield . "\" . gameInfo["Name"].Value . "-0" . a_index . ".*",labelArray%currentLabel% . "-0" . a_index,AssetTypeArray%currentLabel%,extensions, obj)
    				if (parentDbName){
    					obj := BuildAssetsTable(A_loopfield . "\" . gameInfo["CloneOf"].Value . ".*","Parent " . labelArray%currentLabel%,AssetTypeArray%currentLabel%,extensions, obj)
    					Loop, 9
    						obj := BuildAssetsTable(A_loopfield . "\" . gameInfo["CloneOf"].Value . "-0" . a_index . ".*","Parent " . labelArray%currentLabel% . "-0" . a_index,AssetTypeArray%currentLabel%,extensions, obj)
    				}
    				;adding rom named assets
    				obj := BuildAssetsTable(A_loopfield . "\" . romName . ".*","Rom " . labelArray%currentLabel%,AssetTypeArray%currentLabel%,extensions, obj)
    				Loop, 9
    					obj := BuildAssetsTable(A_loopfield . "\" . romName . "-0" . a_index . ".*","Rom " . labelArray%currentLabel% . "-0" . a_index,AssetTypeArray%currentLabel%,extensions, obj)
    			} else { ;system assets
    				obj := BuildAssetsTable(A_loopfield . "\" . gameInfo["Platform"].Value . ".*",labelArray%currentLabel%,AssetTypeArray%currentLabel%,extensions, obj)
    				Loop, 9
    					obj := BuildAssetsTable(A_loopfield . "\" . gameInfo["Platform"].Value . "-0" . a_index . ".*",labelArray%currentLabel% . "-0" . a_index,AssetTypeArray%currentLabel%,extensions, obj)
    			}
    		}
    	}
    	Return obj
    }
    
    loadAdditionalFEAssets(){
    	Global additionalFEAssetsLoaded, feMedia, frontendPath, gameInfo
    	
    	;Loading labels from ini files
    	feArtworkLabels:= RIniLoadVar("GlobalPluginsIni","SystemPluginsIni", "LaunchBox", "Fe_Artwork_Labels", "Advertisement Flyer - Back|Advertisement Flyer - Front|Arcade - Cabinet|Arcade - Circuit Board|Arcade - Control Panel|Arcade - Controls Information|Arcade - Marquee|Banner|Box - 3D|Box - Back|Box - Back - Reconstructed|Box - Front|Box - Front - Reconstructed|Cart - 3D|Cart - Back|Cart - Front|Disc|Fanart - Box - Back|Fanart - Box - Front|Fanart - Cart - Back|Fanart - Cart - Front|Fanart - Disc|Screenshot - Game Over|Screenshot - Game Select|Screenshot - Game Title|Screenshot - Gameplay|Screenshot - High Scores|Steam Banner|Screenshot - Gameplay - Cabinet|Screenshot - Gameplay - Controls|Screenshot - Gameplay - CP|Screenshot - Gameplay - GameOver|Screenshot - Gameplay - Marquee|Screenshot - Gameplay - PCB|Screenshot - Gameplay - Score|Screenshot - Gameplay - Select|Screenshot - Gameplay - Snap|Screenshot - Gameplay - Title")
    	feControllerLabels:= RIniLoadVar("GlobalPluginsIni","SystemPluginsIni", "LaunchBox", "Fe_Controller_Labels", "")
    	feGuidesLabels:= RIniLoadVar("GlobalPluginsIni","SystemPluginsIni", "LaunchBox", "Fe_Guides_Labels", "")
    	feManualsLabels:= RIniLoadVar("GlobalPluginsIni","SystemPluginsIni", "LaunchBox", "Fe_Manuals_Labels", "Game Manual")
    	feVideosLabels:= RIniLoadVar("GlobalPluginsIni","SystemPluginsIni", "LaunchBox", "Fe_Videos_Labels", "Game Video|System Video")
    	
    	;Acquiring ArtWork
    	feArtworkPaths1 := frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Advertisement Flyer - Back" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Advertisement Flyer - Front" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Arcade - Cabinet" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Arcade - Circuit Board" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Arcade - Control Panel" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Arcade - Controls Information" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Arcade - Marquee" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Banner" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Box - 3D" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Box - Back" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Box - Back - Reconstructed" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Box - Front" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Box - Front - Reconstructed" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Cart - 3D" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Cart - Back" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Cart - Front" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Disc"
    	feArtworkPaths2 := frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Fanart - Box - Back" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Fanart - Box - Front" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Fanart - Cart - Back" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Fanart - Cart - Front" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Fanart - Disc" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - Game Over" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - Game Select" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - Game Title" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - Gameplay" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - High Scores" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Steam Banner" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - Gameplay\Cabinet" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - Gameplay\Controls" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - Gameplay\CP" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - Gameplay\GameOver" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - Gameplay\Marquee" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - Gameplay\PCB" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - Gameplay\Score" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - Gameplay\Select" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - Gameplay\Snap" . "|" . frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Screenshot - Gameplay\Title" 
    	feMedia.Artwork := launchboxProcessExtraFiles(feArtworkPaths1 . "|" . feArtworkPaths2, feArtworkLabels, "game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game|game", "png|bmp|gif|jpg|tif")
    	
    	;Acquiring Videos
    	gameVideoPath := frontendPath . "\Videos\" . gameInfo["Platform"].Value
    	systemVideoPath := frontendPath . "\Videos\Platforms\" . gameInfo["Platform"].Value
    	feMedia.Videos := launchboxProcessExtraFiles(gameVideoPath . "|" . systemVideoPath,feVideosLabels,"game|system","mp4,flv")
    	
    	;Acquiring Manuals
    	gameManualPath := frontendPath . "\Manuals\" . gameInfo["Platform"].Value
    	feMedia.Manuals := launchboxProcessExtraFiles(gameManualPath,feManualsLabels,"game","pdf")
    
    	;Acquiring Controller (not available or location unknown on LaunchBox folders)
    	;Acquiring Guides (not available or location unknown on LaunchBox folders)
    	
    	additionalFEAssetsLoaded := true
    	Return
    }
     

  10. Collapse Details
    Re: Launchbox plugin not pulling media correctly 
    #10
    RocketLauncher Developer

    MainSecondary
    Join Date
    Apr 2014
    Posts
    4,791
    I'm not really sure about those Regex replaces, I mean this problem should appear in the HS plugin too right? And it seems to be dealt differently in there, could you please have a look at this bleasby to see if this is the best way to fix it or if it should be handled differently?
     

  11. Collapse Details
    Re: Launchbox plugin not pulling media correctly 
    #11
    Senior Member

    MainSecondary
    Join Date
    Oct 2016
    Posts
    517
    The other issue is, Discs are not showing. I found this line in the plugin:

    ;Acquiring Disc artwork (not available or location unknown on LaunchBox folders)

    The location is the 'Disc' folder, e.g. LaunchBox\Images\Sony Playstation\Disc

    I tried editing the line below to this:

    gameDiscPath := frontendPath . "\Images\" . gameInfo["Platform"].Value . "\Disc"

    ...to match the other entries (backgrounds, etc.), but I still can't get discs to appear in Pause.


    Edit: I just realized I can put disc images in the Multigame folder and all will work, so it's probably the best solution for all frontends.
    Last edited by SupraKarma ; 12-30-2017 at 09:09 AM.
     

  12. Collapse Details
    Re: Launchbox plugin not pulling media correctly 
    #12
    Senior Member


    MainSecondary
    Join Date
    Jul 2014
    Posts
    227
    Brolly,

    I think the reason this is a problem for Launchbox and not HS is because launchbox renames your games to a standardized naming on import to match it's database. So if you import "Super Mario Bros. (USA).sfc" into launchbox, the xml will be written like "Super Mario Bros." I think RL is looking for "Super Mario Bros. (USA).png" for example, but when launchbox downloads artwork for the game it'll be named like "Super Mario Bros.png-01" etc.
     

  13. Collapse Details
    Re: Launchbox plugin not pulling media correctly 
    #13
    Member
    MainSecondary
    Join Date
    Oct 2014
    Posts
    71
    Is anybody else having trouble displaying all the metadata fields when fade is used? I have updated the plugin to Suprakarna’s revision, but the only info it shows for me on fade is game name and year. No publisher, developer, genre and they are checked in Rlui to display text.

    Also from a testing perspective, I have recently been redoing all my fades over. When using Rlui’s fade test function, only the game name shows on the info bar. In order to get the year to show, I actually have to boot a game from within launch box to display it.

    If you’re using the launch box plugin, shouldn’t it pull the full game info for fade testing even if launchbox isn’t running?
     

  14. Collapse Details
    Re: Launchbox plugin not pulling media correctly 
    #14
    Super Moderator
    agent47's Avatar
    MainSecondary
    Join Date
    Jan 2016
    Posts
    1,109
    Quote Originally Posted by trnzaddict View Post
    When using Rlui’s fade test function, only the game name shows on the info bar. In order to get the year to show, I actually have to boot a game from within launch box to display it.

    If you’re using the launch box plugin, shouldn’t it pull the full game info for fade testing even if launchbox isn’t running?
    http://www.rlauncher.com/forum/showt...ll=1#post40294
     

  15. Collapse Details
    Re: Launchbox plugin not pulling media correctly 
    #15
    RocketLauncher Developer

    MainSecondary
    Join Date
    Apr 2014
    Posts
    4,791
    I honestly don't know how you manage to keep track of all those posts
     

  16. Collapse Details
    Re: Launchbox plugin not pulling media correctly 
    #16
    Senior Member
    MainSecondary
    Join Date
    Feb 2015
    Posts
    158
    Not sure if this is related, but when I have Launchbox set on my system, Fade uses the "Name" field rather than the "Description" field which gives some wacky results when the files use odd naming standards i.e, MAME. Does anyone else have this?

    For example in Fade, the game "Time Crisis" is displayed as "timecris". It works fine with Hyperspin, which leads me to believe it's something to do with the Launchbox module rather than the Fade module.
     

  17. Collapse Details
    Re: Launchbox plugin not pulling media correctly 
    #17
    Junior Member
    MainSecondary
    Join Date
    Mar 2018
    Posts
    1
    I've run into a media problem as well. I've got my fade set up to use the clear logo image, but it only works on some games and not others even though Launchbox/BigBox displays the image.

    After digging around, it looks like the issue is with LaunchBox's region folders for images. If the image is in (system)/Clear Logos/, it works fine. If it's in (system)/Clear Logos/(region)/, RL doesn't see it.

    I can try manually moving the images into the main Clear Logo folder, but I'd have to do that for every system, and repeat every time new games are added. Is there any way to have the plugin search the subfolders as well?
     

  18. Collapse Details
    Re: Launchbox plugin not pulling media correctly 
    #18
    Member
    MainSecondary
    Join Date
    Jan 2015
    Posts
    74
    Have you found a solution for this? Just came across this issue as well.
     

  19. Collapse Details
    Re: Launchbox plugin not pulling media correctly 
    #19
    Super Moderator
    agent47's Avatar
    MainSecondary
    Join Date
    Jan 2016
    Posts
    1,109
    The plugin could be modified to search region subfolders but the potential problem with that is priority if images are found in multiple regions and/or the main images directory.

    I don't use LB so I don't know the specifics but I vaguely remember hearing about region priorities. I'm not sure if that only applies to roms or images as well but if there was a setting for it we could read that and that would probably take care of it.
     

  20. Collapse Details
    Re: Launchbox plugin not pulling media correctly 
    #20
    Junior Member
    MainSecondary
    Join Date
    Nov 2018
    Posts
    8
    I found one more character that needs to be addressed, and it's the forward slash, "/"

    The edited plugin works fairly well, but 3 Count Bout / Fire Suplex is an example of a game that doesn't work still.
     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •