Author Topic: Modifying Gameinfo structure  (Read 5112 times)

rand0m

  • Sr. Member
  • ****
  • Posts: 343
    • View Profile
Modifying Gameinfo structure
« on: February 06, 2017, 10:39:48 PM »
Is it possible to modify gameinfo structure and add some more categories like region, language and series info in it? or perhaps gather this info from another text file through "additional import files"? (simple catver.ini structure doesn't work I have already tried that)

I have also tried to add that information in tags (which seems like the best place of adding such info) but don't know anyway of limiting the return to one value. E.g. lets say a game Pang has the tags "Japan;Japanese;Pang series" (Region/Language/Series). I don't know how to call one tag (maybe there is a find in string function or "contains" expression) in this string. Listing tags via (info.Tags) simply lists all Tags which beats the purpose.


jedione

  • Hero Member
  • *****
  • Posts: 1135
  • punktoe
    • View Profile
Re: Modifying Gameinfo structure
« Reply #1 on: February 07, 2017, 07:02:19 AM »
why not just put whatever you want in a spot that your not using? then call it with magictokin

#Name;Title;Emulator;CloneOf;Year;Manufacturer;Category;Players;Rotation;Control;Status;DisplayCount;DisplayType;AltRomname;AltTitle;Extra;Buttons

local info = fe.add_text("[Category]", 850, 202, 195, 050 ),

Cannon.Spike;Cannon.Spike;dreamcast;;;;here is my game info;;;;;;;;;;


is their any theme that uses every one, not that i know of..
« Last Edit: February 07, 2017, 07:05:41 AM by jedione »
help a friend....

rand0m

  • Sr. Member
  • ****
  • Posts: 343
    • View Profile
Re: Modifying Gameinfo structure
« Reply #2 on: February 08, 2017, 02:20:02 AM »
Thanks jedoine, I added the required info (region & language) under [DisplayCount] and [DisplayType] heads. Its working as expected and since info is accessible via magic tokens it can be easily accessed in themes  :D


(IMHO Dev should consider either giving us the option to modify the game info structure for consoles (non-mame) or somehow quantify tags (Tag1, Tag2, Tag3...) which can be called separately from layouts. Tags are attract-mode dependent so won't come in way of importing rom info from other sources like hyperspin xmls or internet gamedatabases.)

liquid8d

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 442
    • View Profile
Re: Modifying Gameinfo structure
« Reply #3 on: February 09, 2017, 08:11:23 PM »
Isn't that what the 'Extra' field is for - or is that used with MAME data?

Can you not use a filter? Because if you are already using tags, you can have a filter that includes multiple tags or individual ones. That setup is a bit of a pain to do manually, but if it's a one-shot setup, you can just edit the  editing the tag file, and add the filter into attract.cfg in notepad pretty easily.

rand0m

  • Sr. Member
  • ****
  • Posts: 343
    • View Profile
Re: Modifying Gameinfo structure
« Reply #4 on: February 10, 2017, 06:57:34 AM »
AFAIK Extra field is not being used by any database (even MAME) but the problem I am facing with "Extra" is same as "Tags". If I add more then one category I can't call them separately. If I add Region and Language info it will list both. In a layout I am trying to develop I want to call them separately and list the outcome in separate places. i.e. if region is "USA" add a specific image, list [Language] info at a specific place. Tags use ; as separator (can be used it in [Extra] too), I don't know of anyway to define the "if" statement so it lists the correct info. For example:

function romreg () {
     if (fe.game_info (Info.Tags) == "USA") return "/images/flags/usa.png";
     else if (fe.game_info (Info.Tags) == "Japan") return "/images/flags/japan.png";
     else if (fe.game_info (info.Tags) == "Europe") return  "/images/flags/europe.png";
     else if (fe.game_info (info.Tags) != "Japan" || "USA" || "Europe" return "/images/flags/unknown.png";
     }

local romregi = fe.add_image ("[!romreg], 0,0,200,100];

 
This doesn't work because there will be more then one Tag on said rom and it won't be equal. If I use "!=" it will be use less in this case. Something like following would work with both Tags and Extra:

if (fe.game_info (Info.Tags) Contains the String "USA") return "/images/flags/usa.png"

I have tried finding out if there is any "contain" expression in squirrel or "find in string" expression but have not found any yet which works.

2) I am already using filters based on tags. The basic structure is something like: console system > Filters (based on Category contains "catver info") > Categories (based on catver.ini, manual input to catver via excel:  Action, Adventure, beat 'em Up etc).

If I add filters with both region;category it will greatly increase the amount of filters (Platform;USA, Platform;Japan, Platform:Europe and so on), if I add a filter with Platform;USA/Japan/EU I will be back to square one (this is similar to Filter:Platform, there is no way of calling 'region' info from layout). Since basic organization is through filters i don't want to go the first way.

Currently I am using [DisplayType] & [DisplayCount] heads for [Region] and [Language] (manually changed that) but that means if I ever update the gameinfo through hyperspin .xml, mame.xml or any online database the values I added will be rewritten. Tags would ideally be the place since they are AM specific and wont won't interfere with other databases.

liquid8d

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 442
    • View Profile
Re: Modifying Gameinfo structure
« Reply #5 on: February 11, 2017, 03:17:05 AM »
Yes, tags would definitely be a better place to store that, and that allows you to adjust your filters based on the tags! Extra is really best used for text about the game or something like that..

You can use string.find(search, startIndex) to find a substring in squirrel. Here's some info on strings for squirrel:
https://electricimp.com/docs/squirrel/string/

And here's an example flag image using tags for region:
Code: [Select]
local flag = fe.add_image("[!game_region]", 0, 30, 64, 64)
function game_region() {
    local tags = fe.game_info(Info.Tags).tolower()
    if (tags.find("usa") != null ) return "images/flags/usa.png"
    else if (tags.find("japan") != null ) return "images/flags/japan.png"
    else if (tags.find("europe") != null ) return  "images/flags/europe.png"
    else return "images/flags/unknown.png"
}

Note that tags and the find function are case-sensitive so I converted the taglist to lowercase before using find. Tags is a delimited string using semicolons, so if you needed a more exact search, you could use split() to do more with the tag list.
« Last Edit: February 11, 2017, 03:19:36 AM by liquid8d »

rand0m

  • Sr. Member
  • ****
  • Posts: 343
    • View Profile
Re: Modifying Gameinfo structure
« Reply #6 on: February 11, 2017, 01:54:50 PM »
Yes, tags would definitely be a better place to store that, and that allows you to adjust your filters based on the tags! Extra is really best used for text about the game or something like that..

You can use string.find(search, startIndex) to find a substring in squirrel. Here's some info on strings for squirrel:
https://electricimp.com/docs/squirrel/string/

And here's an example flag image using tags for region:
Code: [Select]
local flag = fe.add_image("[!game_region]", 0, 30, 64, 64)
function game_region() {
    local tags = fe.game_info(Info.Tags).tolower()
    if (tags.find("usa") != null ) return "images/flags/usa.png"
    else if (tags.find("japan") != null ) return "images/flags/japan.png"
    else if (tags.find("europe") != null ) return  "images/flags/europe.png"
    else return "images/flags/unknown.png"
}

Note that tags and the find function are case-sensitive so I converted the taglist to lowercase before using find. Tags is a delimited string using semicolons, so if you needed a more exact search, you could use split() to do more with the tag list.


Thanks a lot liquid8d its working perfectly now :D