diff --git a/.DS_Store b/.DS_Store index b928088..75ed3e9 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/.github/workflows/BuildDockerOnTag.yml b/.github/workflows/BuildDockerOnTag.yml index a4963cd..e4e1a6d 100644 --- a/.github/workflows/BuildDockerOnTag.yml +++ b/.github/workflows/BuildDockerOnTag.yml @@ -12,6 +12,8 @@ jobs: - name: Checkout uses: actions/checkout@v3 + with: + submodules: 'true' - name: Set up QEMU uses: docker/setup-qemu-action@v2 diff --git a/.gitmodules b/.gitmodules index e69de29..6863741 100644 --- a/.gitmodules +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "gaseous-server/wwwroot/EmulatorJS"] + path = gaseous-server/wwwroot/EmulatorJS + url = https://github.com/EmulatorJS/EmulatorJS.git diff --git a/README.MD b/README.MD index 8022cfb..0a48c1f 100644 --- a/README.MD +++ b/README.MD @@ -16,6 +16,7 @@ The following projects are used by Gaseous * https://github.com/JamesNK/Newtonsoft.Json * https://www.nuget.org/packages/MySql.Data/8.0.32.1 * https://github.com/kamranayub/igdb-dotnet +* https://github.com/EmulatorJS/EmulatorJS ## Configuration File When Gaseous-Server is started for the first time, it creates a configuration file at ~/.gaseous-server/config.json if it doesn't exist. Some values can be filled in using environment variables (such as in the case of using docker). @@ -105,4 +106,4 @@ Loop through each of the search candidates searching using: 2. "wherefuzzy" - partial match using wildcards 3. "search" - uses a more flexible search method -Note: that if more than one result is found, the image will be set as "Unknown" as there is no way for Gaseous to know which title is the correct one. \ No newline at end of file +Note: that if more than one result is found, the image will be set as "Unknown" as there is no way for Gaseous to know which title is the correct one. diff --git a/gaseous-server/.DS_Store b/gaseous-server/.DS_Store index f0d37de..a751656 100644 Binary files a/gaseous-server/.DS_Store and b/gaseous-server/.DS_Store differ diff --git a/gaseous-server/Classes/Roms.cs b/gaseous-server/Classes/Roms.cs index a22b3e4..70c59cc 100644 --- a/gaseous-server/Classes/Roms.cs +++ b/gaseous-server/Classes/Roms.cs @@ -107,6 +107,19 @@ namespace gaseous_server.Classes Path = (string)romDR["path"], Source = (GameRomItem.SourceType)(Int32)romDR["metadatasource"] }; + + // check for a web emulator and update the romItem + foreach (Models.PlatformMapping.PlatformMapItem platformMapping in Models.PlatformMapping.PlatformMap) + { + if (platformMapping.IGDBId == romItem.PlatformId) + { + if (platformMapping.WebEmulator != null) + { + romItem.Emulator = platformMapping.WebEmulator; + } + } + } + return romItem; } @@ -115,6 +128,7 @@ namespace gaseous_server.Classes public long Id { get; set; } public long PlatformId { get; set; } public IGDB.Models.Platform Platform { get; set; } + public Dictionary? Emulator { get; set; } public long GameId { get; set; } public string? Name { get; set; } public long Size { get; set; } diff --git a/gaseous-server/Controllers/GamesController.cs b/gaseous-server/Controllers/GamesController.cs index 0dce880..ca019eb 100644 --- a/gaseous-server/Controllers/GamesController.cs +++ b/gaseous-server/Controllers/GamesController.cs @@ -749,6 +749,7 @@ namespace gaseous_server.Controllers } [HttpGet] + [HttpHead] [Route("{GameId}/roms/{RomId}/file")] [ProducesResponseType(typeof(FileStreamResult), StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status404NotFound)] diff --git a/gaseous-server/Models/PlatformMapping.cs b/gaseous-server/Models/PlatformMapping.cs index f97dd7b..70408c8 100644 --- a/gaseous-server/Models/PlatformMapping.cs +++ b/gaseous-server/Models/PlatformMapping.cs @@ -78,6 +78,8 @@ namespace gaseous_server.Models public string IGDBName { get; set; } public List AlternateNames { get; set; } = new List(); public List KnownFileExtensions { get; set; } = new List(); + public Dictionary? WebEmulator { get; set; } + } } } diff --git a/gaseous-server/Program.cs b/gaseous-server/Program.cs index 82181bf..08d0eec 100644 --- a/gaseous-server/Program.cs +++ b/gaseous-server/Program.cs @@ -76,7 +76,11 @@ app.UseResponseCaching(); app.UseAuthorization(); app.UseDefaultFiles(); -app.UseStaticFiles(); +app.UseStaticFiles(new StaticFileOptions +{ + ServeUnknownFileTypes = true, //allow unkown file types also to be served + DefaultContentType = "plain/text" //content type to returned if fileType is not known. +}); app.MapControllers(); diff --git a/gaseous-server/Support/PlatformMap.json b/gaseous-server/Support/PlatformMap.json index 2790941..2b61be6 100644 --- a/gaseous-server/Support/PlatformMap.json +++ b/gaseous-server/Support/PlatformMap.json @@ -60,7 +60,11 @@ ".MD", ".SG", ".SMD" - ] + ], + "WebEmulator": { + "Type": "EmulatorJS", + "Core": "segaMD" + } }, { "IGDBId": 4, @@ -71,7 +75,11 @@ ], "KnownFileExtensions": [ ".Z64" - ] + ], + "WebEmulator": { + "Type": "EmulatorJS", + "Core": "n64" + } }, { "IGDBId": 18, @@ -88,6 +96,10 @@ ".SFC", ".SMC", ".SWC" - ] + ], + "WebEmulator": { + "Type": "EmulatorJS", + "Core": "nes" + } } ] diff --git a/gaseous-server/gaseous-server.csproj b/gaseous-server/gaseous-server.csproj index 98adb37..50fdd8a 100644 --- a/gaseous-server/gaseous-server.csproj +++ b/gaseous-server/gaseous-server.csproj @@ -119,6 +119,10 @@ + + + + @@ -165,4 +169,9 @@ + + + Always + + diff --git a/gaseous-server/wwwroot/.DS_Store b/gaseous-server/wwwroot/.DS_Store index 022e6ad..d8ac01f 100644 Binary files a/gaseous-server/wwwroot/.DS_Store and b/gaseous-server/wwwroot/.DS_Store differ diff --git a/gaseous-server/wwwroot/EmulatorJS b/gaseous-server/wwwroot/EmulatorJS new file mode 160000 index 0000000..f7fa5d4 --- /dev/null +++ b/gaseous-server/wwwroot/EmulatorJS @@ -0,0 +1 @@ +Subproject commit f7fa5d41487a424233b40e903020455606d68fee diff --git a/gaseous-server/wwwroot/pages/EmulatorJS.html b/gaseous-server/wwwroot/pages/EmulatorJS.html new file mode 100644 index 0000000..bb720d2 --- /dev/null +++ b/gaseous-server/wwwroot/pages/EmulatorJS.html @@ -0,0 +1,25 @@ +
+
+
+ + + \ No newline at end of file diff --git a/gaseous-server/wwwroot/pages/emulator.html b/gaseous-server/wwwroot/pages/emulator.html new file mode 100644 index 0000000..d742394 --- /dev/null +++ b/gaseous-server/wwwroot/pages/emulator.html @@ -0,0 +1,48 @@ +
+
+
+ +
+ + diff --git a/gaseous-server/wwwroot/pages/game.html b/gaseous-server/wwwroot/pages/game.html index 80a1851..bd878fd 100644 --- a/gaseous-server/wwwroot/pages/game.html +++ b/gaseous-server/wwwroot/pages/game.html @@ -304,7 +304,7 @@ var newTable = document.createElement('table'); newTable.className = 'romtable'; newTable.setAttribute('cellspacing', 0); - newTable.appendChild(createTableRow(true, ['Name', 'Size', 'Media', '', ''])); + newTable.appendChild(createTableRow(true, ['Name', 'Size', 'Media', '', '', ''])); var lastPlatform = ''; for (var i = 0; i < result.length; i++) { @@ -318,11 +318,17 @@ newTable.appendChild(platformRow); } + var launchButton = ''; + if (result[i].emulator) { + launchButton = 'Start'; + } + var newRow = [ '' + result[i].name + '', formatBytes(result[i].size, 2), result[i].romTypeMedia, result[i].mediaLabel, + launchButton, '...' ]; newTable.appendChild(createTableRow(false, newRow, 'romrow', 'romcell')); diff --git a/gaseous-server/wwwroot/styles/style.css b/gaseous-server/wwwroot/styles/style.css index 449efc9..1b3d73e 100644 --- a/gaseous-server/wwwroot/styles/style.css +++ b/gaseous-server/wwwroot/styles/style.css @@ -578,4 +578,10 @@ button:disabled { .redbutton:disabled { background-color: #555; +} + +#emulator { + margin: 0 auto; + width: 640px; + padding-top: 100px; } \ No newline at end of file