WIP
This commit is contained in:
@@ -1298,6 +1298,7 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
Platform? platform = Platforms.GetPlatform(Id);
|
Platform? platform = Platforms.GetPlatform(Id);
|
||||||
if (platform != null)
|
if (platform != null)
|
||||||
{
|
{
|
||||||
|
platform.Name = hasheousPlatform.Name;
|
||||||
platform.PlatformLogo = (long)platformLogo.Id;
|
platform.PlatformLogo = (long)platformLogo.Id;
|
||||||
Storage.NewCacheValue<Platform>(HasheousClient.Models.MetadataSources.None, platform, true);
|
Storage.NewCacheValue<Platform>(HasheousClient.Models.MetadataSources.None, platform, true);
|
||||||
}
|
}
|
||||||
|
@@ -81,6 +81,12 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// populate age group data
|
||||||
|
if (result.MetadataSource == HasheousClient.Models.MetadataSources.IGDB)
|
||||||
|
{
|
||||||
|
AgeGroups.GetAgeGroup(result);
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,7 +266,7 @@ SELECT DISTINCT
|
|||||||
FROM
|
FROM
|
||||||
view_Games_Roms
|
view_Games_Roms
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
Platform ON view_Games_Roms.PlatformId = Platform.Id
|
Platform ON view_Games_Roms.PlatformId = Platform.Id AND Platform.SourceId = view_Games_Roms.GameIdType
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
User_RecentPlayedRoms ON User_RecentPlayedRoms.UserId = @userid
|
User_RecentPlayedRoms ON User_RecentPlayedRoms.UserId = @userid
|
||||||
AND User_RecentPlayedRoms.GameId = view_Games_Roms.MetadataMapId
|
AND User_RecentPlayedRoms.GameId = view_Games_Roms.MetadataMapId
|
||||||
@@ -358,6 +364,7 @@ ORDER BY Platform.`Name`;";
|
|||||||
{
|
{
|
||||||
Id = platform.Id,
|
Id = platform.Id,
|
||||||
Name = platform.Name,
|
Name = platform.Name,
|
||||||
|
MetadataMapId = (long)row["MetadataMapId"],
|
||||||
Category = platform.Category,
|
Category = platform.Category,
|
||||||
emulatorConfiguration = emulatorConfiguration,
|
emulatorConfiguration = emulatorConfiguration,
|
||||||
LastPlayedRomId = LastPlayedRomId,
|
LastPlayedRomId = LastPlayedRomId,
|
||||||
@@ -371,6 +378,9 @@ ORDER BY Platform.`Name`;";
|
|||||||
platforms.Add(valuePair);
|
platforms.Add(valuePair);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sort platforms by the Name attribute
|
||||||
|
platforms.Sort((x, y) => x.Name.CompareTo(y.Name));
|
||||||
|
|
||||||
return platforms;
|
return platforms;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -404,6 +414,7 @@ ORDER BY Platform.`Name`;";
|
|||||||
|
|
||||||
public class AvailablePlatformItem : HasheousClient.Models.Metadata.IGDB.Platform
|
public class AvailablePlatformItem : HasheousClient.Models.Metadata.IGDB.Platform
|
||||||
{
|
{
|
||||||
|
public long MetadataMapId { get; set; }
|
||||||
public PlatformMapping.UserEmulatorConfiguration emulatorConfiguration { get; set; }
|
public PlatformMapping.UserEmulatorConfiguration emulatorConfiguration { get; set; }
|
||||||
public long? LastPlayedRomId { get; set; }
|
public long? LastPlayedRomId { get; set; }
|
||||||
public bool? LastPlayedRomIsMediagroup { get; set; }
|
public bool? LastPlayedRomIsMediagroup { get; set; }
|
||||||
|
@@ -41,15 +41,14 @@ namespace gaseous_server.Classes.Metadata
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Platform? RetVal = new Platform();
|
Platform? RetVal = new Platform();
|
||||||
if (Source == HasheousClient.Models.MetadataSources.None)
|
|
||||||
{
|
|
||||||
|
|
||||||
RetVal = (Platform?)Storage.GetCacheValue<Platform>(HasheousClient.Models.MetadataSources.None, RetVal, "Id", (long)Id);
|
RetVal = (Platform?)Storage.GetCacheValue<Platform>(HasheousClient.Models.MetadataSources.None, RetVal, "Id", (long)Id);
|
||||||
}
|
if (Source != HasheousClient.Models.MetadataSources.None)
|
||||||
else
|
{
|
||||||
|
if (RetVal == null)
|
||||||
{
|
{
|
||||||
RetVal = Metadata.GetMetadata<Platform>(Source, (long)Id, false);
|
RetVal = Metadata.GetMetadata<Platform>(Source, (long)Id, false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return RetVal;
|
return RetVal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -370,7 +370,7 @@ namespace gaseous_server.Classes
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
Logging.Log(Logging.LogType.Information, "Metadata Refresh", "(" + StatusCounter + "/" + dt.Rows.Count + "): Refreshing metadata for platform " + dr["name"] + " (" + dr["id"] + ")");
|
Logging.Log(Logging.LogType.Information, "Metadata Refresh", "(" + StatusCounter + "/" + dt.Rows.Count + "): Refreshing metadata for platform " + dr["name"] + " (" + dr["id"] + ")");
|
||||||
Metadata.Platforms.GetPlatform((long)dr["id"]);
|
Metadata.Platforms.GetPlatform((long)dr["id"], MetadataSources.None);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@@ -123,10 +123,12 @@ namespace gaseous_server.Controllers
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Platform platformObject = Classes.Metadata.Platforms.GetPlatform(PlatformId);
|
HasheousClient.Models.MetadataSources metadataSources = HasheousClient.Models.MetadataSources.None;
|
||||||
|
|
||||||
|
Platform platformObject = Classes.Metadata.Platforms.GetPlatform(PlatformId, metadataSources);
|
||||||
PlatformLogo? logoObject = null;
|
PlatformLogo? logoObject = null;
|
||||||
|
|
||||||
logoObject = PlatformLogos.GetPlatformLogo((long)platformObject.PlatformLogo, Communications.MetadataSource);
|
logoObject = PlatformLogos.GetPlatformLogo((long)platformObject.PlatformLogo, metadataSources);
|
||||||
|
|
||||||
if (logoObject == null)
|
if (logoObject == null)
|
||||||
{
|
{
|
||||||
@@ -135,7 +137,7 @@ namespace gaseous_server.Controllers
|
|||||||
{
|
{
|
||||||
if (platformObject.Versions.Count > 0)
|
if (platformObject.Versions.Count > 0)
|
||||||
{
|
{
|
||||||
PlatformVersion platformVersion = Classes.Metadata.PlatformVersions.GetPlatformVersion(Communications.MetadataSource, (long)platformObject.Versions[0]);
|
PlatformVersion platformVersion = Classes.Metadata.PlatformVersions.GetPlatformVersion(metadataSources, (long)platformObject.Versions[0]);
|
||||||
logoObject = PlatformLogos.GetPlatformLogo((long)platformVersion.PlatformLogo);
|
logoObject = PlatformLogos.GetPlatformLogo((long)platformVersion.PlatformLogo);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -149,13 +151,13 @@ namespace gaseous_server.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string basePath = Path.Combine(Config.LibraryConfiguration.LibraryMetadataDirectory_Platform(platformObject), Communications.MetadataSource.ToString());
|
string basePath = Path.Combine(Config.LibraryConfiguration.LibraryMetadataDirectory_Platform(platformObject), metadataSources.ToString());
|
||||||
string imagePath = Path.Combine(basePath, size.ToString(), logoObject.ImageId);
|
string imagePath = Path.Combine(basePath, size.ToString(), logoObject.ImageId);
|
||||||
|
|
||||||
if (!System.IO.File.Exists(imagePath))
|
if (!System.IO.File.Exists(imagePath))
|
||||||
{
|
{
|
||||||
Communications comms = new Communications();
|
Communications comms = new Communications();
|
||||||
Task<string> ImgFetch = comms.GetSpecificImageFromServer(Communications.MetadataSource, Path.Combine(Config.LibraryConfiguration.LibraryMetadataDirectory_Platform(platformObject)), logoObject.ImageId, size, new List<Communications.IGDBAPI_ImageSize> { Communications.IGDBAPI_ImageSize.cover_big, Communications.IGDBAPI_ImageSize.original });
|
Task<string> ImgFetch = comms.GetSpecificImageFromServer(metadataSources, Path.Combine(Config.LibraryConfiguration.LibraryMetadataDirectory_Platform(platformObject)), logoObject.ImageId, size, new List<Communications.IGDBAPI_ImageSize> { Communications.IGDBAPI_ImageSize.cover_big, Communications.IGDBAPI_ImageSize.original });
|
||||||
|
|
||||||
imagePath = ImgFetch.Result;
|
imagePath = ImgFetch.Result;
|
||||||
}
|
}
|
||||||
@@ -163,7 +165,7 @@ namespace gaseous_server.Controllers
|
|||||||
if (!System.IO.File.Exists(imagePath))
|
if (!System.IO.File.Exists(imagePath))
|
||||||
{
|
{
|
||||||
Communications comms = new Communications();
|
Communications comms = new Communications();
|
||||||
Task<string> ImgFetch = comms.GetSpecificImageFromServer(Communications.MetadataSource, basePath, logoObject.ImageId, size, new List<Communications.IGDBAPI_ImageSize> { Communications.IGDBAPI_ImageSize.cover_big, Communications.IGDBAPI_ImageSize.original });
|
Task<string> ImgFetch = comms.GetSpecificImageFromServer(metadataSources, basePath, logoObject.ImageId, size, new List<Communications.IGDBAPI_ImageSize> { Communications.IGDBAPI_ImageSize.cover_big, Communications.IGDBAPI_ImageSize.original });
|
||||||
|
|
||||||
imagePath = ImgFetch.Result;
|
imagePath = ImgFetch.Result;
|
||||||
}
|
}
|
||||||
|
@@ -627,7 +627,7 @@ class RomManagement {
|
|||||||
let metadataContent = metadataModal.modalElement.querySelector('#modal-body');
|
let metadataContent = metadataModal.modalElement.querySelector('#modal-body');
|
||||||
|
|
||||||
// fetch the metadata map
|
// fetch the metadata map
|
||||||
let metadataMap = await fetch('/api/v1.1/Games/' + gameId + '/metadata', {
|
let metadataMap = await fetch('/api/v1.1/Games/' + callingObject.Platform.metadataMapId + '/metadata', {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
@@ -699,7 +699,7 @@ class RomManagement {
|
|||||||
if (element.link) {
|
if (element.link) {
|
||||||
if (element.link.length > 0) {
|
if (element.link.length > 0) {
|
||||||
let contentLabel4 = document.createElement('div');
|
let contentLabel4 = document.createElement('div');
|
||||||
contentLabel4.innerHTML = 'Link: ' + element.link;
|
contentLabel4.innerHTML = 'Link: <a href="' + element.link + '" target="_blank" rel="noopener noreferrer" class="romlink">' + element.link + '</a>';
|
||||||
itemSectionContent.appendChild(contentLabel4);
|
itemSectionContent.appendChild(contentLabel4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -716,7 +716,7 @@ class RomManagement {
|
|||||||
let okButton = new ModalButton('OK', 1, callingObject, async function (callingObject) {
|
let okButton = new ModalButton('OK', 1, callingObject, async function (callingObject) {
|
||||||
let model = metadataMap.metadataMapItems;
|
let model = metadataMap.metadataMapItems;
|
||||||
|
|
||||||
await fetch('/api/v1.1/Games/' + gameId + '/metadata', {
|
await fetch('/api/v1.1/Games/' + callingObject.Platform.metadataMapId + '/metadata', {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
@@ -755,7 +755,7 @@ class RomManagement {
|
|||||||
let defaultPlatformMap = platformMap;
|
let defaultPlatformMap = platformMap;
|
||||||
|
|
||||||
// get the user emulation configuration
|
// get the user emulation configuration
|
||||||
let userEmuConfig = await fetch('/api/v1.1/Games/' + gameId + '/emulatorconfiguration/' + callingObject.Platform.id, {
|
let userEmuConfig = await fetch('/api/v1.1/Games/' + callingObject.Platform.metadataMapId + '/emulatorconfiguration/' + callingObject.Platform.id, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
@@ -783,7 +783,7 @@ class RomManagement {
|
|||||||
|
|
||||||
// setup the buttons
|
// setup the buttons
|
||||||
let resetButton = new ModalButton('Reset to Default', 0, callingObject, async function (callingObject) {
|
let resetButton = new ModalButton('Reset to Default', 0, callingObject, async function (callingObject) {
|
||||||
await fetch('/api/v1.1/Games/' + gameId + '/emulatorconfiguration/' + callingObject.Platform.id, {
|
await fetch('/api/v1.1/Games/' + callingObject.Platform.metadataMapId + '/emulatorconfiguration/' + callingObject.Platform.id, {
|
||||||
method: 'DELETE'
|
method: 'DELETE'
|
||||||
});
|
});
|
||||||
callingObject.Platform.emulatorConfiguration.emulatorType = defaultPlatformMap.webEmulator.type;
|
callingObject.Platform.emulatorConfiguration.emulatorType = defaultPlatformMap.webEmulator.type;
|
||||||
@@ -802,7 +802,7 @@ class RomManagement {
|
|||||||
EnableBIOSFiles: emuConfig.PlatformMap.enabledBIOSHashes
|
EnableBIOSFiles: emuConfig.PlatformMap.enabledBIOSHashes
|
||||||
}
|
}
|
||||||
|
|
||||||
await fetch('/api/v1.1/Games/' + gameId + '/emulatorconfiguration/' + callingObject.Platform.id, {
|
await fetch('/api/v1.1/Games/' + callingObject.Platform.metadataMapId + '/emulatorconfiguration/' + callingObject.Platform.id, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
@@ -843,7 +843,7 @@ class RomManagement {
|
|||||||
async #loadMediaGroups() {
|
async #loadMediaGroups() {
|
||||||
this.MediaGroupCount = 0;
|
this.MediaGroupCount = 0;
|
||||||
|
|
||||||
fetch('/api/v1.1/Games/' + gameId + '/romgroup?platformid=' + this.Platform.id, {
|
fetch('/api/v1.1/Games/' + this.Platform.metadataMapId + '/romgroup?platformid=' + this.Platform.id, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
@@ -872,7 +872,7 @@ class RomManagement {
|
|||||||
let saveStatesButton = '';
|
let saveStatesButton = '';
|
||||||
if (this.Platform.emulatorConfiguration) {
|
if (this.Platform.emulatorConfiguration) {
|
||||||
if ((this.Platform.emulatorConfiguration.emulatorType.length > 0) && (this.Platform.emulatorConfiguration.core.length > 0)) {
|
if ((this.Platform.emulatorConfiguration.emulatorType.length > 0) && (this.Platform.emulatorConfiguration.core.length > 0)) {
|
||||||
let romPath = encodeURIComponent('/api/v1.1/Games/' + gameId + '/romgroup/' + mediaGroup.id + '/' + gameData.name + '.zip');
|
let romPath = encodeURIComponent('/api/v1.1/Games/' + this.Platform.metadataMapId + '/romgroup/' + mediaGroup.id + '/' + gameData.name + '.zip');
|
||||||
|
|
||||||
if (mediaGroup.hasSaveStates == true) {
|
if (mediaGroup.hasSaveStates == true) {
|
||||||
let modalVariables = {
|
let modalVariables = {
|
||||||
@@ -887,13 +887,13 @@ class RomManagement {
|
|||||||
};
|
};
|
||||||
saveStatesButton = document.createElement('div');
|
saveStatesButton = document.createElement('div');
|
||||||
saveStatesButton.addEventListener('click', () => {
|
saveStatesButton.addEventListener('click', () => {
|
||||||
let stateManager = new EmulatorStateManager(mediaGroup.id, true, this.Platform.emulatorConfiguration.emulatorType, this.Platform.emulatorConfiguration.core, mediaGroup.platformId, gameId, romPath);
|
let stateManager = new EmulatorStateManager(mediaGroup.id, true, this.Platform.emulatorConfiguration.emulatorType, this.Platform.emulatorConfiguration.core, mediaGroup.platformId, this.Platform.metadataMapId, romPath);
|
||||||
stateManager.open();
|
stateManager.open();
|
||||||
});
|
});
|
||||||
saveStatesButton.innerHTML = '<img src="/images/SaveStates.png" class="savedstateicon" />';
|
saveStatesButton.innerHTML = '<img src="/images/SaveStates.png" class="savedstateicon" />';
|
||||||
}
|
}
|
||||||
|
|
||||||
launchButton = '<a href="/index.html?page=emulator&engine=' + this.Platform.emulatorConfiguration.emulatorType + '&core=' + this.Platform.emulatorConfiguration.core + '&platformid=' + mediaGroup.platformId + '&gameid=' + gameId + '&romid=' + mediaGroup.id + '&mediagroup=1&rompath=' + romPath + '" class="romstart">Launch</a>';
|
launchButton = '<a href="/index.html?page=emulator&engine=' + this.Platform.emulatorConfiguration.emulatorType + '&core=' + this.Platform.emulatorConfiguration.core + '&platformid=' + mediaGroup.platformId + '&gameid=' + this.Platform.metadataMapId + '&romid=' + mediaGroup.id + '&mediagroup=1&rompath=' + romPath + '" class="romstart">Launch</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -909,7 +909,7 @@ class RomManagement {
|
|||||||
favouriteRom.src = '/images/favourite-empty.svg';
|
favouriteRom.src = '/images/favourite-empty.svg';
|
||||||
}
|
}
|
||||||
favouriteRom.addEventListener('click', async () => {
|
favouriteRom.addEventListener('click', async () => {
|
||||||
await fetch('/api/v1.1/Games/' + gameId + '/roms/' + mediaGroup.id + '/' + mediaGroup.platformId + '/favourite?IsMediaGroup=true&favourite=true', {
|
await fetch('/api/v1.1/Games/' + this.Platform.metadataMapId + '/roms/' + mediaGroup.id + '/' + mediaGroup.platformId + '/favourite?IsMediaGroup=true&favourite=true', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
@@ -954,7 +954,7 @@ class RomManagement {
|
|||||||
break;
|
break;
|
||||||
case "Completed":
|
case "Completed":
|
||||||
statusText = 'Available';
|
statusText = 'Available';
|
||||||
downloadLink = '<a href="/api/v1.1/Games/' + gameId + '/romgroup/' + mediaGroup.id + '/' + gameData.name + '.zip" class="romlink"><img src="/images/download.svg" class="banner_button_image" alt="Download" title="Download" /></a>';
|
downloadLink = '<a href="/api/v1.1/Games/' + this.Platform.metadataMapId + '/romgroup/' + mediaGroup.id + '/' + gameData.name + '.zip" class="romlink"><img src="/images/download.svg" class="banner_button_image" alt="Download" title="Download" /></a>';
|
||||||
packageSize = formatBytes(mediaGroup.size);
|
packageSize = formatBytes(mediaGroup.size);
|
||||||
launchButtonContent = launchButton;
|
launchButtonContent = launchButton;
|
||||||
break;
|
break;
|
||||||
@@ -984,7 +984,7 @@ class RomManagement {
|
|||||||
|
|
||||||
let deleteButton = new ModalButton("Delete", 2, deleteWindow, function (callingObject) {
|
let deleteButton = new ModalButton("Delete", 2, deleteWindow, function (callingObject) {
|
||||||
ajaxCall(
|
ajaxCall(
|
||||||
'/api/v1.1/Games/' + gameId + '/romgroup/' + mediaGroup.id,
|
'/api/v1.1/Games/' + this.Platform.metadataMapId + '/romgroup/' + mediaGroup.id,
|
||||||
'DELETE',
|
'DELETE',
|
||||||
function (result) {
|
function (result) {
|
||||||
thisObject.#loadRoms();
|
thisObject.#loadRoms();
|
||||||
@@ -1088,7 +1088,7 @@ class RomManagement {
|
|||||||
let gameRomsSection = this.Roms;
|
let gameRomsSection = this.Roms;
|
||||||
let gameRoms = this.RomsContent;
|
let gameRoms = this.RomsContent;
|
||||||
let pageSize = 200;
|
let pageSize = 200;
|
||||||
await fetch('/api/v1.1/Games/' + gameId + '/roms?pageNumber=' + pageNumber + '&pageSize=' + pageSize + '&platformId=' + selectedPlatform + nameSearchQuery, {
|
await fetch('/api/v1.1/Games/' + this.Platform.metadataMapId + '/roms?pageNumber=' + pageNumber + '&pageSize=' + pageSize + '&platformId=' + selectedPlatform + nameSearchQuery, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
@@ -1153,7 +1153,7 @@ class RomManagement {
|
|||||||
if (this.Platform.emulatorConfiguration) {
|
if (this.Platform.emulatorConfiguration) {
|
||||||
if (this.Platform.emulatorConfiguration.emulatorType) {
|
if (this.Platform.emulatorConfiguration.emulatorType) {
|
||||||
if (this.Platform.emulatorConfiguration.emulatorType.length > 0) {
|
if (this.Platform.emulatorConfiguration.emulatorType.length > 0) {
|
||||||
let romPath = encodeURIComponent('/api/v1.1/Games/' + gameId + '/roms/' + gameRomItems[i].id + '/' + gameRomItems[i].name);
|
let romPath = encodeURIComponent('/api/v1.1/Games/' + this.Platform.metadataMapId + '/roms/' + gameRomItems[i].id + '/' + gameRomItems[i].name);
|
||||||
if (gameRomItems[i].hasSaveStates == true) {
|
if (gameRomItems[i].hasSaveStates == true) {
|
||||||
let modalVariables = {
|
let modalVariables = {
|
||||||
"romId": gameRomItems[i].id,
|
"romId": gameRomItems[i].id,
|
||||||
@@ -1161,28 +1161,27 @@ class RomManagement {
|
|||||||
"engine": this.Platform.emulatorConfiguration.emulatorType,
|
"engine": this.Platform.emulatorConfiguration.emulatorType,
|
||||||
"core": this.Platform.emulatorConfiguration.core,
|
"core": this.Platform.emulatorConfiguration.core,
|
||||||
"platformid": gameRomItems[i].platformId,
|
"platformid": gameRomItems[i].platformId,
|
||||||
"gameid": gameId,
|
"gameid": this.Platform.metadataMapId,
|
||||||
"mediagroup": 0,
|
"mediagroup": 0,
|
||||||
"rompath": romPath
|
"rompath": romPath
|
||||||
};
|
};
|
||||||
saveStatesButton = document.createElement('div');
|
saveStatesButton = document.createElement('div');
|
||||||
saveStatesButton.addEventListener('click', () => {
|
saveStatesButton.addEventListener('click', () => {
|
||||||
let stateManager = new EmulatorStateManager(gameRomItems[i].id, false, this.Platform.emulatorConfiguration.emulatorType, this.Platform.emulatorConfiguration.core, gameRomItems[i].platformId, gameId, gameRomItems[i].name);
|
let stateManager = new EmulatorStateManager(gameRomItems[i].id, false, this.Platform.emulatorConfiguration.emulatorType, this.Platform.emulatorConfiguration.core, gameRomItems[i].platformId, this.Platform.metadataMapId, gameRomItems[i].name);
|
||||||
stateManager.open();
|
stateManager.open();
|
||||||
});
|
});
|
||||||
saveStatesButton.innerHTML = '<img src="/images/SaveStates.png" class="savedstateicon" />';
|
saveStatesButton.innerHTML = '<img src="/images/SaveStates.png" class="savedstateicon" />';
|
||||||
}
|
}
|
||||||
launchButton = '<a href="/index.html?page=emulator&engine=' + this.Platform.emulatorConfiguration.emulatorType + '&core=' + this.Platform.emulatorConfiguration.core + '&platformid=' + gameRomItems[i].platformId + '&gameid=' + gameId + '&romid=' + gameRomItems[i].id + '&mediagroup=0&rompath=' + romPath + '" class="romstart">Launch</a>';
|
launchButton = '<a href="/index.html?page=emulator&engine=' + this.Platform.emulatorConfiguration.emulatorType + '&core=' + this.Platform.emulatorConfiguration.core + '&platformid=' + gameRomItems[i].platformId + '&gameid=' + this.Platform.metadataMapId + '&romid=' + gameRomItems[i].id + '&mediagroup=0&rompath=' + romPath + '" class="romstart">Launch</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let romInfoButton = document.createElement('div');
|
let romInfoButton = document.createElement('div');
|
||||||
romInfoButton.className = 'properties_button';
|
romInfoButton.className = 'properties_button';
|
||||||
//romInfoButton.setAttribute('onclick', 'showDialog(\'rominfo\', ' + gameRomItems[i].id + ');');
|
|
||||||
romInfoButton.setAttribute('data-romid', gameRomItems[i].id);
|
romInfoButton.setAttribute('data-romid', gameRomItems[i].id);
|
||||||
romInfoButton.addEventListener('click', function () {
|
romInfoButton.addEventListener('click', () => {
|
||||||
const romInfoDialog = new rominfodialog(gameId, this.getAttribute('data-romid'));
|
const romInfoDialog = new rominfodialog(this.Platform.metadataMapId, gameRomItems[i].id);
|
||||||
romInfoDialog.open();
|
romInfoDialog.open();
|
||||||
});
|
});
|
||||||
romInfoButton.innerHTML = 'i';
|
romInfoButton.innerHTML = 'i';
|
||||||
@@ -1209,7 +1208,7 @@ class RomManagement {
|
|||||||
favouriteRom.src = '/images/favourite-empty.svg';
|
favouriteRom.src = '/images/favourite-empty.svg';
|
||||||
}
|
}
|
||||||
favouriteRom.addEventListener('click', async () => {
|
favouriteRom.addEventListener('click', async () => {
|
||||||
await fetch('/api/v1.1/Games/' + gameId + '/roms/' + gameRomItems[i].id + '/' + gameRomItems[i].platformId + '/favourite?IsMediaGroup=false&favourite=true', {
|
await fetch('/api/v1.1/Games/' + this.Platform.metadataMapId + '/roms/' + gameRomItems[i].id + '/' + gameRomItems[i].platformId + '/favourite?IsMediaGroup=false&favourite=true', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
@@ -1236,7 +1235,7 @@ class RomManagement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let romLink = document.createElement('a');
|
let romLink = document.createElement('a');
|
||||||
romLink.href = '/api/v1.1/Games/' + gameId + '/roms/' + gameRomItems[i].id + '/' + encodeURIComponent(gameRomItems[i].name);
|
romLink.href = '/api/v1.1/Games/' + this.Platform.metadataMapId + '/roms/' + gameRomItems[i].id + '/' + encodeURIComponent(gameRomItems[i].name);
|
||||||
romLink.className = 'romlink';
|
romLink.className = 'romlink';
|
||||||
romLink.innerHTML = gameRomItems[i].name;
|
romLink.innerHTML = gameRomItems[i].name;
|
||||||
|
|
||||||
@@ -1265,51 +1264,51 @@ class RomManagement {
|
|||||||
this.#DisplayROMCheckboxes(true);
|
this.#DisplayROMCheckboxes(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result.count > pageSize) {
|
// if (result.count > pageSize) {
|
||||||
// draw pagination
|
// // draw pagination
|
||||||
let numOfPages = Math.ceil(result.count / pageSize);
|
// let numOfPages = Math.ceil(result.count / pageSize);
|
||||||
|
|
||||||
let romPaginator = document.createElement('div');
|
// let romPaginator = document.createElement('div');
|
||||||
romPaginator.id = 'romPaginator';
|
// romPaginator.id = 'romPaginator';
|
||||||
romPaginator.className = 'rom_pager';
|
// romPaginator.className = 'rom_pager';
|
||||||
|
|
||||||
// draw previous page button
|
// // draw previous page button
|
||||||
let prevPage = document.createElement('span');
|
// let prevPage = document.createElement('span');
|
||||||
prevPage.className = 'rom_pager_number_disabled';
|
// prevPage.className = 'rom_pager_number_disabled';
|
||||||
prevPage.innerHTML = '<';
|
// prevPage.innerHTML = '<';
|
||||||
if (pageNumber != 1) {
|
// if (pageNumber != 1) {
|
||||||
prevPage.setAttribute('onclick', 'loadRoms(' + undefined + ', ' + (pageNumber - 1) + ', ' + selectedPlatform + ');');
|
// prevPage.setAttribute('onclick', 'loadRoms(' + undefined + ', ' + (pageNumber - 1) + ', ' + selectedPlatform + ');');
|
||||||
prevPage.className = 'rom_pager_number';
|
// prevPage.className = 'rom_pager_number';
|
||||||
}
|
// }
|
||||||
romPaginator.appendChild(prevPage);
|
// romPaginator.appendChild(prevPage);
|
||||||
|
|
||||||
// draw page numbers
|
// // draw page numbers
|
||||||
for (let i = 0; i < numOfPages; i++) {
|
// for (let i = 0; i < numOfPages; i++) {
|
||||||
let romPaginatorPage = document.createElement('span');
|
// let romPaginatorPage = document.createElement('span');
|
||||||
romPaginatorPage.className = 'rom_pager_number_disabled';
|
// romPaginatorPage.className = 'rom_pager_number_disabled';
|
||||||
romPaginatorPage.innerHTML = (i + 1);
|
// romPaginatorPage.innerHTML = (i + 1);
|
||||||
if ((i + 1) != pageNumber) {
|
// if ((i + 1) != pageNumber) {
|
||||||
romPaginatorPage.setAttribute('onclick', 'loadRoms(' + undefined + ', ' + (i + 1) + ', ' + selectedPlatform + ');');
|
// romPaginatorPage.setAttribute('onclick', 'loadRoms(' + undefined + ', ' + (i + 1) + ', ' + selectedPlatform + ');');
|
||||||
romPaginatorPage.className = 'rom_pager_number';
|
// romPaginatorPage.className = 'rom_pager_number';
|
||||||
}
|
// }
|
||||||
|
|
||||||
romPaginator.appendChild(romPaginatorPage);
|
// romPaginator.appendChild(romPaginatorPage);
|
||||||
}
|
// }
|
||||||
|
|
||||||
// draw next page button
|
// // draw next page button
|
||||||
let nextPage = document.createElement('span');
|
// let nextPage = document.createElement('span');
|
||||||
nextPage.className = 'rom_pager_number_disabled';
|
// nextPage.className = 'rom_pager_number_disabled';
|
||||||
nextPage.innerHTML = '>';
|
// nextPage.innerHTML = '>';
|
||||||
if (pageNumber != numOfPages) {
|
// if (pageNumber != numOfPages) {
|
||||||
nextPage.setAttribute('onclick', 'loadRoms(' + undefined + ', ' + (pageNumber + 1) + ', ' + selectedPlatform + ');');
|
// nextPage.setAttribute('onclick', 'loadRoms(' + undefined + ', ' + (pageNumber + 1) + ', ' + selectedPlatform + ');');
|
||||||
nextPage.className = 'rom_pager_number';
|
// nextPage.className = 'rom_pager_number';
|
||||||
}
|
// }
|
||||||
romPaginator.appendChild(nextPage);
|
// romPaginator.appendChild(nextPage);
|
||||||
|
|
||||||
gameRoms.appendChild(romPaginator);
|
// gameRoms.appendChild(romPaginator);
|
||||||
|
|
||||||
gameRomsSection.appendChild(gameRoms);
|
// gameRomsSection.appendChild(gameRoms);
|
||||||
}
|
// }
|
||||||
} else {
|
} else {
|
||||||
gameRomsSection.setAttribute('style', 'display: none;');
|
gameRomsSection.setAttribute('style', 'display: none;');
|
||||||
}
|
}
|
||||||
@@ -1443,7 +1442,7 @@ class RomManagement {
|
|||||||
if (rom_checks[i].checked == true) {
|
if (rom_checks[i].checked == true) {
|
||||||
let romId = rom_checks[i].getAttribute('data-romid');
|
let romId = rom_checks[i].getAttribute('data-romid');
|
||||||
remapCallCounter += 1;
|
remapCallCounter += 1;
|
||||||
let deletePath = '/api/v1.1/Games/' + gameId + '/roms/' + romId;
|
let deletePath = '/api/v1.1/Games/' + this.Platform.metadataMapId + '/roms/' + romId;
|
||||||
let parentObject = this;
|
let parentObject = this;
|
||||||
ajaxCall(deletePath, 'DELETE', function (result) {
|
ajaxCall(deletePath, 'DELETE', function (result) {
|
||||||
parentObject.#remapTitlesCallback();
|
parentObject.#remapTitlesCallback();
|
||||||
@@ -1472,7 +1471,7 @@ class RomManagement {
|
|||||||
if (rom_checks[i].checked == true) {
|
if (rom_checks[i].checked == true) {
|
||||||
let romId = rom_checks[i].getAttribute('data-romid');
|
let romId = rom_checks[i].getAttribute('data-romid');
|
||||||
remapCallCounter += 1;
|
remapCallCounter += 1;
|
||||||
ajaxCall('/api/v1.1/Games/' + gameId + '/roms/' + romId + '?NewPlatformId=' + fixplatform[0].id + '&NewGameId=' + fixgame[0].id, 'PATCH', function (result) {
|
ajaxCall('/api/v1.1/Games/' + this.Platform.metadataMapId + '/roms/' + romId + '?NewPlatformId=' + fixplatform[0].id + '&NewGameId=' + fixgame[0].id, 'PATCH', function (result) {
|
||||||
thisObject.#remapTitlesCallback();
|
thisObject.#remapTitlesCallback();
|
||||||
}, function (result) {
|
}, function (result) {
|
||||||
thisObject.#remapTitlesCallback();
|
thisObject.#remapTitlesCallback();
|
||||||
@@ -1526,7 +1525,7 @@ class RomManagement {
|
|||||||
let currentObject = this;
|
let currentObject = this;
|
||||||
|
|
||||||
ajaxCall(
|
ajaxCall(
|
||||||
'/api/v1.1/Games/' + gameId + '/romgroup?PlatformId=' + platformId,
|
'/api/v1.1/Games/' + this.Platform.metadataMapId + '/romgroup?PlatformId=' + platformId,
|
||||||
'POST',
|
'POST',
|
||||||
function (result) {
|
function (result) {
|
||||||
currentObject.#DisplayROMCheckboxes(false);
|
currentObject.#DisplayROMCheckboxes(false);
|
||||||
|
@@ -2990,6 +2990,7 @@ button:not(.select2-selection__choice__remove):not(.select2-selection__clear):no
|
|||||||
|
|
||||||
.platform_name {
|
.platform_name {
|
||||||
display: block;
|
display: block;
|
||||||
|
max-width: 75px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.platform_edit_button_container {
|
.platform_edit_button_container {
|
||||||
|
Reference in New Issue
Block a user