Various BIOS file bug fixes
This commit is contained in:
@@ -99,7 +99,11 @@ namespace gaseous_server.Controllers
|
|||||||
if (bios.hash == hash)
|
if (bios.hash == hash)
|
||||||
{
|
{
|
||||||
// add the bios file to the zip
|
// add the bios file to the zip
|
||||||
zipArchive.CreateEntryFromFile(Path.Combine(Config.LibraryConfiguration.LibraryFirmwareDirectory, hash + ".bios"), bios.filename);
|
string biosFilePath = Path.Combine(Config.LibraryConfiguration.LibraryFirmwareDirectory, hash + ".bios");
|
||||||
|
if (System.IO.File.Exists(biosFilePath))
|
||||||
|
{
|
||||||
|
zipArchive.CreateEntryFromFile(biosFilePath, bios.filename);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -46,7 +46,7 @@ namespace gaseous_server.Models
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WritePlatformMap(mapItem, true, true);
|
WritePlatformMap(mapItem, true, true, true);
|
||||||
Logging.Log(Logging.LogType.Information, "Platform Map", "Overwriting " + mapItem.IGDBName + " with default values.");
|
Logging.Log(Logging.LogType.Information, "Platform Map", "Overwriting " + mapItem.IGDBName + " with default values.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -164,7 +164,7 @@ namespace gaseous_server.Models
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void WritePlatformMap(PlatformMapItem item, bool Update, bool AllowAvailableEmulatorOverwrite)
|
public static void WritePlatformMap(PlatformMapItem item, bool Update, bool AllowAvailableEmulatorOverwrite, bool overwriteBios = false)
|
||||||
{
|
{
|
||||||
CreateDummyPlatform(item);
|
CreateDummyPlatform(item);
|
||||||
|
|
||||||
@@ -247,14 +247,21 @@ namespace gaseous_server.Models
|
|||||||
foreach (PlatformMapItem.EmulatorBiosItem biosItem in item.Bios)
|
foreach (PlatformMapItem.EmulatorBiosItem biosItem in item.Bios)
|
||||||
{
|
{
|
||||||
bool isEnabled = false;
|
bool isEnabled = false;
|
||||||
if (item.EnabledBIOSHashes == null)
|
if (overwriteBios == true)
|
||||||
{
|
|
||||||
item.EnabledBIOSHashes = new List<string>();
|
|
||||||
}
|
|
||||||
if (item.EnabledBIOSHashes.Contains(biosItem.hash))
|
|
||||||
{
|
{
|
||||||
isEnabled = true;
|
isEnabled = true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (item.EnabledBIOSHashes == null)
|
||||||
|
{
|
||||||
|
item.EnabledBIOSHashes = new List<string>();
|
||||||
|
}
|
||||||
|
if (item.EnabledBIOSHashes.Contains(biosItem.hash))
|
||||||
|
{
|
||||||
|
isEnabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sql = "INSERT INTO PlatformMap_Bios (Id, Filename, Description, Hash, Enabled) VALUES (@Id, @Filename, @Description, @Hash, @Enabled);";
|
sql = "INSERT INTO PlatformMap_Bios (Id, Filename, Description, Hash, Enabled) VALUES (@Id, @Filename, @Description, @Hash, @Enabled);";
|
||||||
dbDict.Clear();
|
dbDict.Clear();
|
||||||
|
@@ -17,9 +17,9 @@
|
|||||||
<p>This list is pre-populated with some of the more common platforms. New platforms will appear in this list as
|
<p>This list is pre-populated with some of the more common platforms. New platforms will appear in this list as
|
||||||
titles are added.</p>
|
titles are added.</p>
|
||||||
|
|
||||||
<p id="settings_mapping_import" style="display: none;"><button value="Export to JSON"
|
<p id="settings_mapping_import" style="display: none;"><button id="exportjson" value="Export to JSON">Export to
|
||||||
onclick="DownloadJSON();">Export to JSON</button><button id="importjson" value="Import JSON">Import
|
JSON</button><button id="importjson" value="Import JSON">Import
|
||||||
JSON</button><button value="Reset to Default" onclick="loadPlatformMapping(true);">Reset to
|
JSON</button><button id="resetmapping" value="Reset to Default">Reset to
|
||||||
Default</button></p>
|
Default</button></p>
|
||||||
|
|
||||||
<input id='uploadjson' type='file' name='files' hidden />
|
<input id='uploadjson' type='file' name='files' hidden />
|
||||||
|
@@ -70,6 +70,7 @@ function SetupButtons() {
|
|||||||
if (userProfile.roles.includes("Admin")) {
|
if (userProfile.roles.includes("Admin")) {
|
||||||
document.getElementById('settings_mapping_import').style.display = '';
|
document.getElementById('settings_mapping_import').style.display = '';
|
||||||
|
|
||||||
|
// Setup the JSON import button
|
||||||
document.getElementById('uploadjson').addEventListener('change', function () {
|
document.getElementById('uploadjson').addEventListener('change', function () {
|
||||||
$(this).simpleUpload("/api/v1.1/PlatformMaps", {
|
$(this).simpleUpload("/api/v1.1/PlatformMaps", {
|
||||||
start: function (file) {
|
start: function (file) {
|
||||||
@@ -84,6 +85,24 @@ function SetupButtons() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
document.getElementById('importjson').addEventListener('click', openDialog);
|
document.getElementById('importjson').addEventListener('click', openDialog);
|
||||||
|
|
||||||
|
// Setup the JSON export button
|
||||||
|
document.getElementById('exportjson').addEventListener('click', DownloadJSON);
|
||||||
|
|
||||||
|
// Setup the reset to defaults button
|
||||||
|
document.getElementById('resetmapping').addEventListener('click', function () {
|
||||||
|
let warningDialog = new MessageBox("Platform Mapping Reset", "This will reset the platform mappings to the default values. Are you sure you want to continue?");
|
||||||
|
warningDialog.addButton(new ModalButton("OK", 2, warningDialog, async (callingObject) => {
|
||||||
|
loadPlatformMapping(true);
|
||||||
|
callingObject.msgDialog.close();
|
||||||
|
let completedDialog = new MessageBox("Platform Mapping Reset", "All platform mappings have been reset to default values.");
|
||||||
|
completedDialog.open();
|
||||||
|
}));
|
||||||
|
warningDialog.addButton(new ModalButton("Cancel", 0, warningDialog, async (callingObject) => {
|
||||||
|
callingObject.msgDialog.close();
|
||||||
|
}));
|
||||||
|
warningDialog.open();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user