I'm trying to import a mameui style ini folder, and it doesn't like it when the section has a "_" in it, like "[ROOT_FOLDER]". It just ignores sections that have that, but since that's what mameui uses, it makes the mameui import useless (unless you know to manually edit the file and remove the "_").
Really, what I'm trying to do is find a way to import a list of rom names from a text file to create a game list. Is this the only way to do this? It would be nice if you could import a plain text file, without having to create an ini-style file to do it through the mameui import. Or even if you could add games by pasting a comma separated list into a text box.
Do you think either of these ideas would be good to add? And can you fix the "_" bug?
Thanks!
I have not done this before. Are you using Import MAME32 custom list?
I just did a few more quick tests , and it seems to be the name 'ROOT_FOLDER' that causes it to be ignored. [ROOT_folder] , [R_FOLDER], [RO_FOLDER], [ROO_FOLDER], [ROOT_FOLER] are OK
It has nothing to do with underscore
See Code Below. It seems to be deliberate to ignore ?? Why would this be?
Could it be you are not supposed to put game in root, only in subfolders?Here is an ini file in my mame32 :
[FOLDER_SETTINGS]
RootFolderIcon cust1
SubFolderIcon cust2
[ROOT_FOLDER]
[Golden Age]
amidar
armora
astdelux
asteroid
astrob
astrof
bagman
berzerk
bosco
btime
bubbles
buckrog
bzone
carnival
cavenger
ccastles
This is the code, so it should not be hard to make a variation to load comma separated , and to allow ROOT_FOLDER to be visible.
While I was in the code I just added:
- Text to remind on items in 'all games' list would be imported
- Stop duplicates being added (eg running the import twice)
What do you think?
This is the unmodified code:
procedure TfrmMain.ImportMAME32customlist1Click(Sender: TObject);
var
inifile, gamestoadd: TStringList;
dlg: TfrmMAME32Import;
i, gamesadded: Integer;
listname, line: string;
readgame: Boolean;
game: TGame;
begin
if dlgImportMAME32List.Execute then begin
inifile := TStringList.Create;
inifile.LoadFromFile(dlgImportMAME32List.Filename);
dlg := TfrmMAME32Import.Create(self);
for i := 0 to inifile.Count - 1 do begin
if (Pos('[', inifile.Strings[i]) > 0)
and (Pos(']', inifile.Strings[i]) > 0)
and (Pos('FOLDER_SETTINGS', inifile.Strings[i]) = 0)
and (Pos('ROOT_FOLDER', inifile.Strings[i]) = 0) then
dlg.lbxLists.Items.Add(Copy(inifile.Strings[i], 2, Length(inifile.Strings[i]) - 2));
end;
if dlg.ShowModal = mrOK then begin
if dlg.lbxLists.ItemIndex > -1 then begin
gamestoadd := TStringList.Create;
listname := dlg.lbxLists.Items[dlg.lbxLists.ItemIndex];
readgame := False;
// get rom names
for i := 0 to inifile.Count - 1 do begin
line := inifile.Strings[i];
if readgame and (Trim(line) <> '') then gamestoadd.Add(Trim(line));
if Trim(line) = '[' + listname + ']' then readgame := True
else begin
if (Pos('[', inifile.Strings[i]) > 0)
and (Pos(']', inifile.Strings[i]) > 0)
and readgame then readgame := False;
end;
end;
gamesadded := 0;
for i := 0 to gamestoadd.Count - 1 do begin
if FAllGames.GetIndexFromName(gamestoadd.Strings[i]) > -1 then begin
game := FAllGames.GetCopy(FAllGames.GetIndexFromName(gamestoadd.Strings[i]));
FGamelist.Add(game);
Inc(gamesadded);
end;
end;
DisplayGamelist;
gamestoadd.Free;
ShowMessage('Added ' + IntToStr(gamesadded) + ' games to the list.');
end;
end;
dlg.Free;
inifile.Free;
end;
end;