Allow writing to user gamedb in NixHawk

not that any cores have a working implementation yet, see #733
This commit is contained in:
YoshiRulz 2022-02-24 16:37:44 +10:00
parent d466c2694f
commit 0410a4f291
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
2 changed files with 4 additions and 4 deletions

View File

@ -7,7 +7,6 @@ using System.Windows.Forms;
using BizHawk.Common;
using BizHawk.Emulation.Common;
using BizHawk.Client.Common;
using BizHawk.Common.PathExtensions;
// todo - perks - pause, copy to clipboard, backlog length limiting
@ -187,7 +186,7 @@ namespace BizHawk.Client.EmuHawk
{
var gameDbEntry = Emulator.AsGameDBEntryGenerator().GenerateGameDbEntry();
gameDbEntry.Status = picker.PickedStatus;
Database.SaveDatabaseEntry(Path.Combine(PathUtils.ExeDirectoryPath, "gamedb", "gamedb_user.txt"), gameDbEntry); //TODO read-only in Nix builds
Database.SaveDatabaseEntry(gameDbEntry);
MainForm.UpdateDumpInfo(gameDbEntry.Status);
HideShowGameDbButton();
}

View File

@ -66,7 +66,7 @@ namespace BizHawk.Emulation.Common
}
}
public static void SaveDatabaseEntry(string path, CompactGameInfo gameInfo)
public static void SaveDatabaseEntry(CompactGameInfo gameInfo, string filename = "gamedb_user.txt")
{
var sb = new StringBuilder();
sb
@ -96,7 +96,8 @@ namespace BizHawk.Emulation.Common
.Append(gameInfo.MetaData)
.Append(Environment.NewLine);
File.AppendAllText(path, sb.ToString());
File.AppendAllText(Path.Combine(_userRoot, filename), sb.ToString());
DB[gameInfo.Hash] = gameInfo;
}
private static bool initialized = false;