This commit is contained in:
Michael Green
2025-01-07 00:48:56 +11:00
parent fc0d164a96
commit da98b1cd74
9 changed files with 101 additions and 7 deletions

View File

@@ -388,6 +388,21 @@ namespace gaseous_server.Classes
} }
} }
// check attributes for a user manual link
if (HasheousResult.Attributes != null)
{
if (HasheousResult.Attributes.Count > 0)
{
foreach (HasheousClient.Models.AttributeItem attribute in HasheousResult.Attributes)
{
if (attribute.attributeName == HasheousClient.Models.AttributeItem.AttributeName.VIMMManualId)
{
signature.Game.UserManual = attribute.GetType().GetProperty("Link").GetValue(attribute).ToString();
}
}
}
}
return signature; return signature;
} }
} }

View File

@@ -205,6 +205,15 @@ namespace gaseous_server.Classes
// add/get the metadata map // add/get the metadata map
MetadataMap? map = MetadataManagement.NewMetadataMap((long)platform.Id, signature.Game.Name); MetadataMap? map = MetadataManagement.NewMetadataMap((long)platform.Id, signature.Game.Name);
// add any metadata attributes that may be supplied as part of the signature
if (signature.Game.UserManual != null)
{
if (signature.Game.UserManual.Length > 0)
{
MetadataManagement.SetMetadataSupportData((long)map.Id, MetadataManagement.MetadataMapSupportDataTypes.UserManualLink, signature.Game.UserManual);
}
}
// populate map with the sources from the signature if they don't already exist // populate map with the sources from the signature if they don't already exist
bool reloadMap = false; bool reloadMap = false;
foreach (MetadataSources source in Enum.GetValues(typeof(MetadataSources))) foreach (MetadataSources source in Enum.GetValues(typeof(MetadataSources)))

View File

@@ -239,6 +239,7 @@ SELECT DISTINCT
view_Games_Roms.MetadataMapId, view_Games_Roms.MetadataMapId,
view_Games_Roms.GameId, view_Games_Roms.GameId,
view_Games_Roms.PlatformId, view_Games_Roms.PlatformId,
view_Games_Roms.UserManualLink,
Platform.`Name`, Platform.`Name`,
User_RecentPlayedRoms.UserId AS MostRecentUserId, User_RecentPlayedRoms.UserId AS MostRecentUserId,
User_RecentPlayedRoms.RomId AS MostRecentRomId, User_RecentPlayedRoms.RomId AS MostRecentRomId,
@@ -310,7 +311,7 @@ ORDER BY Platform.`Name`;";
} }
} }
// if still no configuration, create a blank one // if still no emulator configuration, create a blank one
if (emulatorConfiguration == null) if (emulatorConfiguration == null)
{ {
emulatorConfiguration = new PlatformMapping.UserEmulatorConfiguration emulatorConfiguration = new PlatformMapping.UserEmulatorConfiguration
@@ -347,6 +348,12 @@ ORDER BY Platform.`Name`;";
} }
} }
string? UserManualLink = null;
if (row["UserManualLink"] != DBNull.Value)
{
UserManualLink = string.IsNullOrEmpty((string?)row["UserManualLink"]) ? "" : (string)row["UserManualLink"];
}
AvailablePlatformItem valuePair = new AvailablePlatformItem AvailablePlatformItem valuePair = new AvailablePlatformItem
{ {
Id = platform.Id, Id = platform.Id,
@@ -358,7 +365,8 @@ ORDER BY Platform.`Name`;";
LastPlayedRomName = LastPlayedRomName, LastPlayedRomName = LastPlayedRomName,
FavouriteRomId = FavouriteRomId, FavouriteRomId = FavouriteRomId,
FavouriteRomIsMediagroup = FavouriteRomIsMediagroup, FavouriteRomIsMediagroup = FavouriteRomIsMediagroup,
FavouriteRomName = FavouriteRomName FavouriteRomName = FavouriteRomName,
UserManualLink = UserManualLink
}; };
platforms.Add(valuePair); platforms.Add(valuePair);
} }
@@ -403,6 +411,7 @@ ORDER BY Platform.`Name`;";
public long? FavouriteRomId { get; set; } public long? FavouriteRomId { get; set; }
public bool? FavouriteRomIsMediagroup { get; set; } public bool? FavouriteRomIsMediagroup { get; set; }
public string? FavouriteRomName { get; set; } public string? FavouriteRomName { get; set; }
public string? UserManualLink { get; set; }
} }
public enum SearchType public enum SearchType

View File

@@ -11,6 +11,11 @@ namespace gaseous_server.Classes
{ {
private static bool Processing = false; private static bool Processing = false;
public enum MetadataMapSupportDataTypes
{
UserManualLink
}
/// <summary> /// <summary>
/// Creates a new metadata map, if one with the same platformId and name does not already exist. /// Creates a new metadata map, if one with the same platformId and name does not already exist.
/// </summary> /// </summary>
@@ -215,6 +220,32 @@ namespace gaseous_server.Classes
return null; return null;
} }
public static void SetMetadataSupportData(long metadataMapId, MetadataMapSupportDataTypes dataType, string data)
{
// verify the metadata map exists
MetadataMap? metadataMap = GetMetadataMap(metadataMapId);
if (metadataMap == null)
{
return;
}
Database db = new Database(Database.databaseType.MySql, Config.DatabaseConfiguration.ConnectionString);
string sql = "";
Dictionary<string, object> dbDict = new Dictionary<string, object>()
{
{ "@metadataMapId", metadataMapId },
{ "@data", data }
};
switch (dataType)
{
case MetadataMapSupportDataTypes.UserManualLink:
sql = "UPDATE MetadataMap SET UserManualLink = @data WHERE Id = @metadataMapId;";
db.ExecuteCMD(sql, dbDict);
break;
}
}
/// <summary> /// <summary>
/// Get the MetadataMapItem for the provided metadata source, and source id /// Get the MetadataMapItem for the provided metadata source, and source id
/// </summary> /// </summary>

View File

@@ -159,6 +159,8 @@ namespace gaseous_server.Models
} }
public string UserManual { get; set; }
[JsonIgnore] [JsonIgnore]
public int Score public int Score
{ {

View File

@@ -116,6 +116,7 @@ CREATE TABLE `MetadataMap` (
`Id` bigint(20) NOT NULL AUTO_INCREMENT, `Id` bigint(20) NOT NULL AUTO_INCREMENT,
`PlatformId` bigint(20) NOT NULL, `PlatformId` bigint(20) NOT NULL,
`SignatureGameName` varchar(255) NOT NULL, `SignatureGameName` varchar(255) NOT NULL,
`UserManualLink` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
INDEX `idx_gamename` ( INDEX `idx_gamename` (
`SignatureGameName`, `SignatureGameName`,
@@ -286,6 +287,7 @@ SELECT
`view_MetadataMap`.`Id` AS `MetadataMapId`, `view_MetadataMap`.`Id` AS `MetadataMapId`,
`view_MetadataMap`.`MetadataSourceType` AS `GameIdType`, `view_MetadataMap`.`MetadataSourceType` AS `GameIdType`,
`view_MetadataMap`.`MetadataSourceId` AS `GameId`, `view_MetadataMap`.`MetadataSourceId` AS `GameId`,
`view_MetadataMap`.`UserManualLink` AS `UserManualLink`,
`Games_Roms`.`Name` AS `Name`, `Games_Roms`.`Name` AS `Name`,
`Games_Roms`.`Size` AS `Size`, `Games_Roms`.`Size` AS `Size`,
`Games_Roms`.`CRC` AS `CRC`, `Games_Roms`.`CRC` AS `CRC`,

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated by Pixelmator Pro 3.6.14 -->
<svg width="800" height="800" viewBox="0 0 800 800" xmlns="http://www.w3.org/2000/svg">
<path id="Path" fill="none" stroke="#000000" stroke-width="33.333332" stroke-linejoin="round" d="M 400 230.302979 C 363.330017 183.630981 306.802002 136.958984 166.706345 133.533997 C 157.504333 133.309326 150 140.78363 150 149.988342 C 150 218.270996 150 476.779999 150 553.233337 C 150 562.436646 157.505005 569.666687 166.704666 569.966675 C 306.801666 574.546692 363.330017 636.660034 400 683.333313 M 400 230.302979 C 436.669983 183.630981 493.196686 136.958984 633.293335 133.533997 C 642.496704 133.309326 650 140.615662 650 149.820313 C 650 226.148987 650 476.880005 650 553.210022 C 650 562.41333 642.496704 569.666687 633.296631 569.966675 C 493.199982 574.546692 436.669983 636.660034 400 683.333313 M 400 230.302979 L 400 683.333313"/>
<path id="path1" fill="none" stroke="#000000" stroke-width="33.333332" stroke-linejoin="round" d="M 641.176697 200 L 716.666687 200 C 725.869995 200 733.333313 207.461975 733.333313 216.666687 L 733.333313 651.299988 C 733.333313 664.786621 717.443359 673.746704 705.116638 668.27002 C 678.613342 656.493286 634.383301 642.106689 576.469971 642.106689 C 478.429993 642.106689 400 700 400 700 C 400 700 321.568665 642.106689 223.529343 642.106689 C 165.615005 642.106689 121.385338 656.493286 94.882339 668.27002 C 82.556 673.746704 66.666664 664.786621 66.666664 651.299988 L 66.666664 216.666687 C 66.666664 207.461975 74.12867 200 83.333336 200 L 158.823669 200"/>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -489,6 +489,16 @@ function LoadGamePlatforms() {
let platformEditButtonContainer = document.createElement('div'); let platformEditButtonContainer = document.createElement('div');
platformEditButtonContainer.className = 'platform_edit_button_container'; platformEditButtonContainer.className = 'platform_edit_button_container';
// create user manual button
let userManualButton = document.createElement('div');
userManualButton.className = 'platform_edit_button';
userManualButton.innerHTML = '<img src="/images/manual.svg" class="banner_button_image" />';
userManualButton.addEventListener('click', (e) => {
e.stopPropagation();
let guideUrl = window.open(result[i].userManualLink, '_blank');
guideUrl.opener = null;
});
// create platform state manager button // create platform state manager button
let platformStateManagerButton = document.createElement('div'); let platformStateManagerButton = document.createElement('div');
if (showSaveState === true) { if (showSaveState === true) {
@@ -518,10 +528,15 @@ function LoadGamePlatforms() {
platformNameContainer.appendChild(platformName); platformNameContainer.appendChild(platformName);
platformItem.appendChild(platformNameContainer); platformItem.appendChild(platformNameContainer);
platformItem.appendChild(platformEditButtonContainer); platformItem.appendChild(platformEditButtonContainer);
platformItem.appendChild(platformEditButton);
if (showSaveState === true) { if (showSaveState === true) {
platformItem.appendChild(platformStateManagerButton); platformEditButtonContainer.appendChild(platformStateManagerButton);
} }
if (result[i].userManualLink) {
platformEditButtonContainer.appendChild(userManualButton);
}
platformEditButtonContainer.appendChild(platformEditButton);
platformContainer.appendChild(platformItem); platformContainer.appendChild(platformItem);
} }
}); });

View File

@@ -2987,16 +2987,21 @@ button:not(.select2-selection__choice__remove):not(.select2-selection__clear):no
} }
.platform_edit_button_container { .platform_edit_button_container {
width: 90px; /* width: 90px; */
flex-grow: 0; flex-grow: 0;
text-align: right;
padding-right: 5px;
} }
.platform_edit_button { .platform_edit_button {
position: absolute; /* position: absolute;
right: 14px; right: 14px;
top: 14px; top: 14px;*/
width: 20px; width: 20px;
height: 20px; height: 20px;
display: inline-block;
margin-left: 10px;
background-color: var(--fancybutton-background); background-color: var(--fancybutton-background);
border-radius: var(--standard-radius); border-radius: var(--standard-radius);
border-width: 1px; border-width: 1px;