Skip to content

Commit

Permalink
Add support for multiple metadata data sources (#474)
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-j-green authored Feb 21, 2025
1 parent 2d63a1c commit c97f119
Show file tree
Hide file tree
Showing 126 changed files with 9,613 additions and 5,332 deletions.
12 changes: 8 additions & 4 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
FROM mcr.microsoft.com/devcontainers/dotnet:1-8.0-bookworm

RUN apt-get update && apt-get install -y p7zip-full
RUN mkdir -p /workspace/gaseous-server/wwwroot/emulators/EmulatorJS
RUN wget https://cdn.emulatorjs.org/releases/4.0.12.7z
RUN 7z x -y -o/workspace/gaseous-server/wwwroot/emulators/EmulatorJS 4.0.12.7z
# update apt-get
RUN apt-get update

# download and unzip EmulatorJS from CDN
RUN apt-get install -y p7zip-full default-jdk nodejs wget
RUN mkdir -p out/wwwroot/emulators/EmulatorJS
RUN wget https://cdn.emulatorjs.org/releases/4.1.1.7z
RUN 7z x -y -oout/wwwroot/emulators/EmulatorJS 4.1.1.7z
23 changes: 11 additions & 12 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/dotnet
{
"name": "C# (.NET)",
"name": "Gaseous C# (.NET)",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
//"image": "mcr.microsoft.com/devcontainers/dotnet:1-8.0-bookworm",
"dockerComposeFile": "docker-compose.yml",
"service": "development",
"workspaceFolder": "/workspace",

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [5198],
"forwardPorts": [
5198
],
"portsAttributes": {
"5198": {
"protocol": "http"
}
"5198": {
"protocol": "http"
}
},

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "dotnet restore",

// Configure tool-specific properties.
"customizations": {
"vscode": {
Expand All @@ -38,11 +36,12 @@
"ms-dotnettools.vscodeintellicode-csharp",
"Zignd.html-css-class-completion",
"PWABuilder.pwa-studio",
"ms-azuretools.vscode-docker"
"ms-azuretools.vscode-docker",
"SonarSource.sonarlint-vscode",
"oderwat.indent-rainbow"
]
}
}

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
}
12 changes: 3 additions & 9 deletions build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,14 @@ RUN dotnet restore "gaseous-server/gaseous-server.csproj" -a $TARGETARCH
# Build and publish a release
RUN dotnet publish "gaseous-server/gaseous-server.csproj" --use-current-runtime --self-contained true -c Release -o out -a $TARGETARCH

# Build Gaseous CLI
# Restore as distinct layers
RUN dotnet restore "gaseous-cli/gaseous-cli.csproj" -a $TARGETARCH
# Build and publish a release
RUN dotnet publish "gaseous-cli/gaseous-cli.csproj" --use-current-runtime --self-contained true -c Release -o out -a $TARGETARCH

# update apt-get
RUN apt-get update

# # download and unzip EmulatorJS from CDN
# download and unzip EmulatorJS from CDN
RUN apt-get install -y p7zip-full
RUN mkdir -p out/wwwroot/emulators/EmulatorJS
RUN wget https://cdn.emulatorjs.org/releases/4.0.12.7z
RUN 7z x -y -oout/wwwroot/emulators/EmulatorJS 4.0.12.7z
RUN wget https://cdn.emulatorjs.org/releases/4.1.1.7z
RUN 7z x -y -oout/wwwroot/emulators/EmulatorJS 4.1.1.7z

# clean up apt-get
RUN apt-get clean && rm -rf /var/lib/apt/lists
Expand Down
12 changes: 3 additions & 9 deletions build/Dockerfile-EmbeddedDB
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,14 @@ RUN dotnet restore "gaseous-server/gaseous-server.csproj" -a $TARGETARCH
# Build and publish a release
RUN dotnet publish "gaseous-server/gaseous-server.csproj" --use-current-runtime --self-contained true -c Release -o out -a $TARGETARCH

# Build Gaseous CLI
# Restore as distinct layers
RUN dotnet restore "gaseous-cli/gaseous-cli.csproj" -a $TARGETARCH
# Build and publish a release
RUN dotnet publish "gaseous-cli/gaseous-cli.csproj" --use-current-runtime --self-contained true -c Release -o out -a $TARGETARCH

# update apt-get
RUN apt-get update

# # download and unzip EmulatorJS from CDN
# download and unzip EmulatorJS from CDN
RUN apt-get install -y p7zip-full
RUN mkdir -p out/wwwroot/emulators/EmulatorJS
RUN wget https://cdn.emulatorjs.org/releases/4.0.12.7z
RUN 7z x -y -oout/wwwroot/emulators/EmulatorJS 4.0.12.7z
RUN wget https://cdn.emulatorjs.org/releases/4.1.1.7z
RUN 7z x -y -oout/wwwroot/emulators/EmulatorJS 4.1.1.7z

# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:8.0
Expand Down
35 changes: 34 additions & 1 deletion gaseous-server/Classes/Bios.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using gaseous_server.Classes.Metadata;
using HasheousClient.Models.Metadata.IGDB;

namespace gaseous_server.Classes
{
Expand All @@ -11,6 +13,37 @@ public Bios()

}

public static void ImportBiosFile(string FilePath, Common.hashObject Hash, ref Dictionary<string, object> BiosFileInfo)
{
BiosFileInfo.Add("type", "bios");
BiosFileInfo.Add("status", "notimported");

foreach (Classes.Bios.BiosItem biosItem in Classes.Bios.GetBios())
{
if (biosItem.Available == false)
{
if (biosItem.hash == Hash.md5hash)
{
string biosPath = Path.Combine(Config.LibraryConfiguration.LibraryFirmwareDirectory, biosItem.hash + ".bios");
Logging.Log(Logging.LogType.Information, "Import BIOS File", " " + FilePath + " is a BIOS file - moving to " + biosPath);

File.Move(FilePath, biosItem.biosPath, true);

BiosFileInfo.Add("name", biosItem.filename);
BiosFileInfo.Add("platform", Platforms.GetPlatform(biosItem.platformid));
BiosFileInfo["status"] = "imported";
}
}
else
{
if (biosItem.hash == Hash.md5hash)
{
BiosFileInfo["status"] = "duplicate";
}
}
}
}

public static void MigrateToNewFolderStructure()
{
// migrate from old BIOS file structure which had each bios file inside a folder named for the platform to the new structure which has each file in a subdirectory named after the MD5 hash
Expand Down Expand Up @@ -94,7 +127,7 @@ private static List<BiosItem> BuildBiosList()
{
if (platformMapping.Bios != null)
{
IGDB.Models.Platform platform = Metadata.Platforms.GetPlatform(platformMapping.IGDBId);
Platform platform = Metadata.Platforms.GetPlatform(platformMapping.IGDBId);

foreach (Models.PlatformMapping.PlatformMapItem.EmulatorBiosItem emulatorBios in platformMapping.Bios)
{
Expand Down
Loading

0 comments on commit c97f119

Please sign in to comment.