From c396a81c1b566222f3221ee5f15abff687535b3c Mon Sep 17 00:00:00 2001 From: Michael Green <84688932+michael-j-green@users.noreply.github.com> Date: Fri, 4 Aug 2023 10:30:22 +1000 Subject: [PATCH] Implement Bulk Change Function (#44) * feat: added Sega 32X and Sega CD mappings * feat: added lazy loading to the main game library * fix: using full file name when loading roms into the emulator #43 * feat: introduced bulk rom matching #25 * fix: xss fix --- gaseous-server/.DS_Store | Bin 6148 -> 6148 bytes gaseous-server/Controllers/GamesController.cs | 35 ++++ gaseous-server/Support/PlatformMap.json | 50 +++++ gaseous-server/wwwroot/emulators/EmulatorJS | 2 +- gaseous-server/wwwroot/index.html | 16 +- gaseous-server/wwwroot/pages/EmulatorJS.html | 4 +- .../wwwroot/pages/dialogs/rominfo.html | 78 +------ .../wwwroot/pages/dialogs/romsdelete.html | 10 + gaseous-server/wwwroot/pages/emulator.html | 8 +- gaseous-server/wwwroot/pages/game.html | 193 +++++++++++++++++- gaseous-server/wwwroot/pages/settings.html | 3 +- .../wwwroot/scripts/gamesformating.js | 10 +- .../wwwroot/scripts/jquery.lazy.min.js | 2 + .../scripts/jquery.lazy.plugins.min.js | 2 + gaseous-server/wwwroot/scripts/main.js | 98 ++++++++- gaseous-server/wwwroot/styles/style.css | 32 ++- 16 files changed, 443 insertions(+), 100 deletions(-) create mode 100644 gaseous-server/wwwroot/pages/dialogs/romsdelete.html create mode 100644 gaseous-server/wwwroot/scripts/jquery.lazy.min.js create mode 100644 gaseous-server/wwwroot/scripts/jquery.lazy.plugins.min.js diff --git a/gaseous-server/.DS_Store b/gaseous-server/.DS_Store index a7c3482cc9dbe5a618cc1215317f80fc330237c1..b1a38183a98217d25ced27d6553110b593c5141f 100644 GIT binary patch delta 122 zcmZoMXfc=|#>B!ku~2NHo+2aL#(>?7i&&T#*(UQaz2pvNC}k)B!hD9JNz6?mCI-ej z3MQr|wK@vbmPQ6Zwx!YJRZPbG>)kVbW*X%+A5j0W^8@N9OO$lles)IT#rj Nm>7UybA-qmW&k^Q9L4|u delta 67 zcmZoMXfc=|#>B)qu~2NHo+2a5#(>?7j4YFRSYB>^$tuURvEd8TW_AvK4xp0Ff*jwO VC-aLqaxee^BLf4=<_M8B%m8&?5X}Gp diff --git a/gaseous-server/Controllers/GamesController.cs b/gaseous-server/Controllers/GamesController.cs index d94ed6a..260a79a 100644 --- a/gaseous-server/Controllers/GamesController.cs +++ b/gaseous-server/Controllers/GamesController.cs @@ -783,6 +783,41 @@ namespace gaseous_server.Controllers } } + [HttpGet] + [HttpHead] + [Route("{GameId}/roms/{RomId}/{FileName}")] + [ProducesResponseType(typeof(FileStreamResult), StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status404NotFound)] + public ActionResult GameRomFile(long GameId, long RomId, string FileName) + { + try + { + IGDB.Models.Game gameObject = Classes.Metadata.Games.GetGame(GameId, false, false); + + Classes.Roms.GameRomItem rom = Classes.Roms.GetRom(RomId); + if (rom.GameId != GameId || rom.Name != FileName) + { + return NotFound(); + } + + string romFilePath = rom.Path; + if (System.IO.File.Exists(romFilePath)) + { + FileStream content = new FileStream(romFilePath, FileMode.Open, FileAccess.Read, FileShare.Read); + FileStreamResult response = File(content, "application/octet-stream", rom.Name); + return response; + } + else + { + return NotFound(); + } + } + catch + { + return NotFound(); + } + } + [HttpGet] [Route("search")] [ProducesResponseType(typeof(List), StatusCodes.Status200OK)] diff --git a/gaseous-server/Support/PlatformMap.json b/gaseous-server/Support/PlatformMap.json index cc688a2..7943952 100644 --- a/gaseous-server/Support/PlatformMap.json +++ b/gaseous-server/Support/PlatformMap.json @@ -187,5 +187,55 @@ "Core": "arcade", "Bios": [] } + }, + { + "IGDBId": 30, + "IGDBName": "Sega 32X", + "AlternateNames": [ + "Sega 32X", + "Sega32", + "Sega32X" + ], + "KnownFileExtensions": [], + "WebEmulator": { + "Type": "EmulatorJS", + "Core": "sega32x", + "Bios": [] + } + }, + { + "IGDBId": 78, + "IGDBName": "Sega CD", + "AlternateNames": [ + "Sega CD", + "Mega CD", + "segacd", + "Sega Mega-CD & Sega CD" + ], + "KnownFileExtensions": [], + "WebEmulator": { + "Type": "EmulatorJS", + "Core": "segaCD", + "Bios": [ + { + "hash": "e66fa1dc5820d254611fdcdba0662372", + "description": "MegaCD EU BIOS - Required", + "filename": "bios_CD_E.bin", + "region": "EU" + }, + { + "hash": "2efd74e3232ff260e371b99f84024f7f", + "description": "SegaCD US BIOS - Required", + "filename": "bios_CD_U.bin", + "region": "US" + }, + { + "hash": "278a9397d192149e84e820ac621a8edd", + "description": "MegaCD JP BIOS - Required", + "filename": "bios_CD_J.bin", + "region": "JP" + } + ] + } } ] diff --git a/gaseous-server/wwwroot/emulators/EmulatorJS b/gaseous-server/wwwroot/emulators/EmulatorJS index 109a832..328a02b 160000 --- a/gaseous-server/wwwroot/emulators/EmulatorJS +++ b/gaseous-server/wwwroot/emulators/EmulatorJS @@ -1 +1 @@ -Subproject commit 109a832ffd25035ffb9d7a128fce469b08aca257 +Subproject commit 328a02bbb613a754b97c19f937d930735d3bca1c diff --git a/gaseous-server/wwwroot/index.html b/gaseous-server/wwwroot/index.html index f1c1104..5d11070 100644 --- a/gaseous-server/wwwroot/index.html +++ b/gaseous-server/wwwroot/index.html @@ -7,6 +7,8 @@ + + @@ -49,11 +51,21 @@ + + + \ No newline at end of file diff --git a/gaseous-server/wwwroot/pages/settings.html b/gaseous-server/wwwroot/pages/settings.html index d001ce8..00ba206 100644 --- a/gaseous-server/wwwroot/pages/settings.html +++ b/gaseous-server/wwwroot/pages/settings.html @@ -20,8 +20,7 @@