diff --git a/backend/requirements.txt b/backend/requirements.txt index 474c4ed34..5e3007f53 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -1,5 +1,5 @@ requests==2.28.2 fastapi==0.92.0 uvicorn==0.20.0 -mariadb==1.0.11 # works in python base image -# mariadb==1.1.6 # works in ubuntu base image \ No newline at end of file +mariadb==1.1.6 +SQLAlchemy==2.0.7 \ No newline at end of file diff --git a/backend/src/config/config.py b/backend/src/config/config.py index fe3cc0ced..d5b060bcf 100644 --- a/backend/src/config/config.py +++ b/backend/src/config/config.py @@ -2,30 +2,31 @@ import os import pathlib # Uvicorn -PORT: int = 5000 -HOST: str = "0.0.0.0" +DEV_PORT: int = 5000 +DEV_HOST: str = "0.0.0.0" # PATHS EMULATION_BASE_PATH: str = f"{pathlib.Path(__file__).parent.parent.parent.parent.resolve()}/emulation" -DEFAULT_LOGO_URL: str = "https://images.igdb.com/igdb/image/upload/t_cover_big/nocover.png" -DEFAULT_LOGO_PATH: str = f"/assets/emulation/resources/default/logo_big.png" +DEFAULT_URL_LOGO: str = "https://images.igdb.com/igdb/image/upload/t_cover_big/nocover.png" +DEFAULT_PATH_LOGO: str = f"/assets/emulation/resources/default/logo_l.png" -DEFAULT_COVER_URL_BIG: str = "https://images.igdb.com/igdb/image/upload/t_cover_big/nocover.png" -DEFAULT_COVER_PATH_BIG: str = f"/assets/emulation/resources/default/cover_big.png" -DEFAULT_COVER_URL_SMALL: str = "https://images.igdb.com/igdb/image/upload/t_cover_small/nocover.png" -DEFAULT_COVER_PATH_SMALL: str = f"/assets/emulation/resources/default/cover_small.png" +DEFAULT_URL_COVER_L: str = "https://images.igdb.com/igdb/image/upload/t_cover_big/nocover.png" +DEFAULT_PATH_COVER_L: str = f"/assets/emulation/resources/default/cover_l.png" +DEFAULT_URL_COVER_S: str = "https://images.igdb.com/igdb/image/upload/t_cover_small/nocover.png" +DEFAULT_PATH_COVER_S: str = f"/assets/emulation/resources/default/cover_s.png" # IGDB -CLIENT_ID=os.getenv('CLIENT_ID') -CLIENT_SECRET=os.getenv('CLIENT_SECRET') +CLIENT_ID: str = os.getenv('CLIENT_ID') +CLIENT_SECRET: str = os.getenv('CLIENT_SECRET') # STEAMGRIDDB -STEAMGRIDDB_API_KEY=os.getenv('STEAMGRIDDB_API_KEY') +STEAMGRIDDB_API_KEY: str = os.getenv('STEAMGRIDDB_API_KEY') # DB -DB_HOST=os.getenv('DB_HOST') -DB_PORT=int(os.getenv('DB_PORT')) -DB_ROOT_PASSWD=os.getenv('DB_ROOT_PASSWD') -DB_USER=os.getenv('DB_USER') -DB_PASSWD=os.getenv('DB_PASSWD') \ No newline at end of file +DB_HOST: str = os.getenv('DB_HOST') +DB_PORT: int = int(os.getenv('DB_PORT')) +DB_ROOT_PASSWD: str = os.getenv('DB_ROOT_PASSWD') +DB_USER: str = os.getenv('DB_USER') +DB_PASSWD: str = os.getenv('DB_PASSWD') +DB_NAME: str = 'romm' \ No newline at end of file diff --git a/backend/src/data/data.py b/backend/src/data/data.py deleted file mode 100644 index 4f5d5edf5..000000000 --- a/backend/src/data/data.py +++ /dev/null @@ -1,27 +0,0 @@ -from dataclasses import dataclass - -from config.config import DEFAULT_LOGO_PATH, DEFAULT_COVER_PATH_BIG, DEFAULT_COVER_PATH_SMALL - - -@dataclass -class Platform: - igdb_id: str = "" - sgdb_id: str = "" - slug: str = "" - name: str = "" - path_logo: str = DEFAULT_LOGO_PATH - - -@dataclass -class Rom: - igdb_id: str = "" - sgdb_id: str = "" - platform_igdb_id: str = "" - platform_sgdb_id: str = "" - filename: str = "" - name: str = "" - slug: str = "" - summary: str = "" - platform_slug: str = "" - path_cover_big: str = DEFAULT_COVER_PATH_BIG - path_cover_small: str = DEFAULT_COVER_PATH_SMALL diff --git a/backend/src/handler/db_handler.py b/backend/src/handler/db_handler.py index 0bb6ed3b0..023a4d758 100644 --- a/backend/src/handler/db_handler.py +++ b/backend/src/handler/db_handler.py @@ -1,122 +1,83 @@ -import os -import sys -from dataclasses import asdict - from fastapi import HTTPException -import mariadb as db +from sqlalchemy import select +from sqlalchemy.exc import ProgrammingError -from config.config import DB_HOST, DB_PORT, DB_USER, DB_PASSWD +from models.base import Session, BaseModel, engine +from models.platform import Platform +from models.rom import Rom from logger.logger import log -class DBHandler: - +class DBHandler: def __init__(self) -> None: - self.DATABASE: str = 'romm' - self.PLATFORM_TABLE: str = 'platform' - self.ROM_TABLE: str = 'rom' - try: - self.conn = db.connect( - host=DB_HOST, - port=DB_PORT, - user=DB_USER, - password=DB_PASSWD, - database=self.DATABASE, - autocommit=True - ) - self.conn.auto_reconnect = True - except db.Error as e: - log.error(f"error connecting to the database: {e}") - sys.exit(1) - self.cur = self.conn.cursor() - - - def regenerate_platform_table(self, igdb_id: str, sgdb_id: str, - slug: str, name: str, path_logo: str) -> None: - try: - self.cur.execute(f""" - create table if not exists {self.PLATFORM_TABLE} - ({igdb_id} varchar(20), {sgdb_id} varchar(20), - {slug} varchar(50), {name} varchar(100), - {path_logo} varchar(500)) - """) - log.info(f"{self.PLATFORM_TABLE} table created") - except Exception as e: - log.error(f"{self.PLATFORM_TABLE} table can't be created: {e}") - raise HTTPException(status_code=500, detail=f"Can't create platform table. {e}") - try: - self.cur.execute(f"truncate {self.PLATFORM_TABLE}") - log.info(f"{self.PLATFORM_TABLE} table truncated") - except Exception as e: - log.error(f"{self.PLATFORM_TABLE} table can't be truncated: {e}") - raise HTTPException(status_code=500, detail=f"Can't truncate platform table. {e}") + BaseModel.metadata.create_all(engine) + self.session = Session() - def regenerate_rom_table(self, igdb_id: str, sgdb_id: str, platform_igdb_id: str, platform_sgdb_id: str, - rom_filename: str, rom_name: str, rom_slug: str, summary: str, platform_slug: str, path_cover_big: str, path_cover_small: str) -> None: - try: - self.cur.execute(f""" - create table if not exists {self.ROM_TABLE} - ({igdb_id} varchar(20), {sgdb_id} varchar(20), - {platform_igdb_id} varchar(20), {platform_sgdb_id} varchar(20), - {rom_filename} varchar(200), {rom_name} varchar(100), - {rom_slug} varchar(100), {summary} text, {platform_slug} varchar(100), - {path_cover_big} varchar(500), {path_cover_small} varchar(500)) - """) - log.info(f"{self.ROM_TABLE} table created") - except Exception as e: - log.error(f"{self.ROM_TABLE} table can't be created: {e}") - raise HTTPException(status_code=500, detail=f"Can't create rom table. {e}") - try: - self.cur.execute(f"truncate {self.ROM_TABLE}") - log.info(f"{self.ROM_TABLE} table truncated") - except Exception as e: - log.error(f"{self.ROM_TABLE} table can't be truncated: {e}") - raise HTTPException(status_code=500, detail=f"Can't truncate rom table. {e}") + def add_platform(self, **kargs) -> None: + with Session.begin() as session: + session.merge(Platform(**kargs)) - def write_platforms(self, platforms: list) -> None: - values: list = [{k: str(v) for k, v in asdict(p).items()} for p in platforms] + def add_platform(self, **kargs) -> None: + with Session.begin() as session: + session.merge(Platform(**kargs)) + + + def get_platforms(self) -> list[Platform]: try: - self.cur.executemany(f"insert into {self.PLATFORM_TABLE} (igdb_id, sgdb_id, slug, name, path_logo) \ - values (%(igdb_id)s, %(sgdb_id)s, %(slug)s, %(name)s, %(path_logo)s)", values) - log.info(f"{self.PLATFORM_TABLE} table populated") - except Exception as e: - log.error(f"{self.PLATFORM_TABLE} can't be populated: {e}") - raise HTTPException(status_code=500, detail=f"Can't write in platform table. {e}") + with Session.begin() as session: + return session.scalars(select(Platform)).all() + except ProgrammingError as e: + raise HTTPException(status_code=404, detail=f"Platforms table not found: {e}") + + def add_platform(self, **kargs) -> None: + try: + with Session.begin() as session: + session.merge(Platform(**kargs)) + except ProgrammingError as e: + raise HTTPException(status_code=404, detail=f"Roms table not found: {e}") + + + def get_roms(self, p_slug: str) -> list[Rom]: + with Session.begin() as session: + return session.scalars(select(Rom).filter_by(p_slug=p_slug)).all() + + + def get_rom(self, p_slug: str, filename: str) -> Rom: + with Session.begin() as session: + return session.scalars(select(Rom).filter_by(p_slug=p_slug, filename=filename)).first() + + + def add_rom(self, **kargs) -> None: + with Session.begin() as session: + session.merge(Rom(**kargs)) - def write_roms(self, roms: list) -> None: - values: list = [{k: str(v) for k, v in asdict(p).items()} for p in roms] - try: - self.cur.executemany(f"insert into {self.ROM_TABLE} (igdb_id, sgdb_id, platform_igdb_id, platform_sgdb_id, filename, name, slug, summary, platform_slug, path_cover_big, path_cover_small) \ - values (%(igdb_id)s, %(sgdb_id)s, %(platform_igdb_id)s, %(platform_sgdb_id)s, %(filename)s, %(name)s, %(slug)s, %(summary)s, %(platform_slug)s, %(path_cover_big)s, %(path_cover_small)s)", values) - log.info(f"{self.ROM_TABLE} table populated") - except Exception as e: - log.error(f"{self.ROM_TABLE} can't be populated: {e}") - raise HTTPException(status_code=500, detail=f"Can't write in platform table. {e}") + + def update_rom(self, p_slug: str, filename: str, data: dict) -> None: + with Session.begin() as session: + session.query(Rom) \ + .filter(Rom.p_slug==p_slug, Rom.filename==filename) \ + .update(data, synchronize_session='evaluate') - def get_platforms(self) -> list: - try: - self.cur.execute(f"select igdb_id, sgdb_id, slug, name, path_logo from {self.PLATFORM_TABLE} order by name asc") - log.info(f"platforms details fetch from {self.PLATFORM_TABLE}") - except Exception as e: - log.error(f"platforms details can't be fetch from {self.PLATFORM_TABLE}") - raise HTTPException(status_code=500, detail=f"Can't read platform table. {e}") - return self.cur - - - def get_roms(self, platform_slug: str) -> list: - try: - self.cur.execute(f"select igdb_id, sgdb_id, platform_igdb_id, platform_sgdb_id, filename, name, slug, summary, platform_slug, path_cover_big, path_cover_small from {self.ROM_TABLE} where platform_slug = '{platform_slug}' order by name asc") - log.info(f"platforms details fetch from {self.ROM_TABLE}") - except Exception as e: - log.error(f"platforms details can't be fetch from {self.ROM_TABLE}") - raise HTTPException(status_code=500, detail=f"Can't read rom table. {e}") - return self.cur + def delete_rom(self, p_slug: str, filename: str) -> None: + with Session.begin() as session: + session.query(Rom) \ + .filter(Rom.p_slug==p_slug, Rom.filename==filename) \ + .delete(synchronize_session='evaluate') - def close_conn(self) -> None: - log.info("closing database connection") - self.conn.close() + def purge_platforms(self, platforms: list) -> None: + with Session.begin() as session: + session.query(Platform) \ + .filter(Platform.slug.not_in(platforms)) \ + .delete(synchronize_session='evaluate') + + + def purge_roms(self, p_slug: str, roms: list) -> None: + with Session.begin() as session: + session.query(Rom) \ + .filter(Rom.p_slug==p_slug, Rom.filename.not_in(roms)) \ + .delete(synchronize_session='evaluate') diff --git a/backend/src/handler/igdb_handler.py b/backend/src/handler/igdb_handler.py index 056166aea..8f15bf339 100644 --- a/backend/src/handler/igdb_handler.py +++ b/backend/src/handler/igdb_handler.py @@ -34,7 +34,7 @@ class IGDBHandler(): url_logo: str = "" try: res_details: dict = requests.post("https://api.igdb.com/v4/platforms/", headers=self.headers, - data=f"fields id, name, platform_logo; where slug=\"{slug}\";").json()[0] + data=f"fields id, name, platform_logo; where slug=\"{slug}\";").json()[0] igdb_id = res_details['id'] name = res_details['name'] id_logo = res_details['platform_logo'] @@ -47,34 +47,35 @@ class IGDBHandler(): url_logo: str = f"https://images.igdb.com/igdb/image/upload/t_logo_med/{res_logo['image_id']}.png" except IndexError: log.warning(f"{slug} logo not found in igdb") - return (igdb_id, name, url_logo) + if not name: name = slug + return igdb_id, name, url_logo @check_twitch_token - def get_rom_details(self, rom_filename: str, platform_id: int) -> dict: - term: str = rom_filename.split('.')[0] + def get_rom_details(self, filename: str, p_igdb_id: int, r_igdb_id: str) -> dict: + filename_no_ext: str = filename.split('.')[0] igdb_id: str = "" slug: str = "" name: str = "" summary: str = "" url_cover: str = "" - if platform_id: + + if r_igdb_id: + res_details: dict = requests.post("https://api.igdb.com/v4/games/", headers=self.headers, + data=f"fields id, slug, name, summary; where id={r_igdb_id};").json()[0] + igdb_id = res_details['id'] + slug = res_details['slug'] + name = res_details['name'] try: - res_details: dict = requests.post("https://api.igdb.com/v4/games/", - headers=self.headers, - data=f"search \"{term}\";fields id, slug, name, summary; where platforms=[{platform_id}] & category=0;").json()[0] - igdb_id = res_details['id'] - slug = res_details['slug'] - name = res_details['name'] + summary = res_details['summary'] + except KeyError: + pass + + else: + if p_igdb_id: try: - summary = res_details['summary'] - except KeyError: - pass - except IndexError: - try: - res_details: dict = requests.post("https://api.igdb.com/v4/games/", - headers=self.headers, - data=f"search \"{term}\";fields name, id, slug, summary; where platforms=[{platform_id}] & category=10;").json()[0] + res_details: dict = requests.post("https://api.igdb.com/v4/games/", headers=self.headers, + data=f"search \"{filename_no_ext}\";fields id, slug, name, summary; where platforms=[{p_igdb_id}] & category=0;").json()[0] igdb_id = res_details['id'] slug = res_details['slug'] name = res_details['name'] @@ -84,9 +85,8 @@ class IGDBHandler(): pass except IndexError: try: - res_details: dict = requests.post("https://api.igdb.com/v4/games/", - headers=self.headers, - data=f"search \"{term}\";fields name, id, slug, summary; where platforms=[{platform_id}];").json()[0] + res_details: dict = requests.post("https://api.igdb.com/v4/games/", headers=self.headers, + data=f"search \"{filename_no_ext}\";fields name, id, slug, summary; where platforms=[{p_igdb_id}] & category=10;").json()[0] igdb_id = res_details['id'] slug = res_details['slug'] name = res_details['name'] @@ -95,16 +95,38 @@ class IGDBHandler(): except KeyError: pass except IndexError: - log.warning(f"{rom_filename} rom not found in igdb") - if igdb_id: - try: - res_details: dict = requests.post("https://api.igdb.com/v4/covers/", - headers=self.headers, - data=f"fields url; where game={igdb_id};").json()[0] - url_cover: str = f"https:{res_details['url']}" - except IndexError: - log.warning(f"{name} cover not found in igdb") - return (igdb_id, slug, name, summary, url_cover) + try: + res_details: dict = requests.post("https://api.igdb.com/v4/games/", headers=self.headers, + data=f"search \"{filename_no_ext}\";fields name, id, slug, summary; where platforms=[{p_igdb_id}];").json()[0] + igdb_id = res_details['id'] + slug = res_details['slug'] + name = res_details['name'] + try: + summary = res_details['summary'] + except KeyError: + pass + except IndexError: + log.warning(f"{filename} rom not found in igdb") + if igdb_id: + try: + res_details: dict = requests.post("https://api.igdb.com/v4/covers/", headers=self.headers, + data=f"fields url; where game={igdb_id};").json()[0] + url_cover: str = f"https:{res_details['url']}" + except IndexError: + log.warning(f"{name} cover not found in igdb") + if not name: name = filename_no_ext + return (igdb_id, filename_no_ext, slug, name, summary, url_cover) + + + @check_twitch_token + def get_matched_roms(self, filename: str, p_igdb_id: int) -> list: + matched_roms: list = requests.post("https://api.igdb.com/v4/games/", headers=self.headers, + data=f"search \"{filename.split('.')[0]}\";fields name, id, slug, summary; where platforms=[{p_igdb_id}];").json() + for rom in matched_roms: + res_details: dict = requests.post("https://api.igdb.com/v4/covers/", headers=self.headers, + data=f"fields url; where game={rom['id']};").json()[0] + rom['url_cover'] = f"https:{res_details['url']}".replace('t_thumb', f't_cover_big') + return matched_roms diff --git a/backend/src/handler/sgdb_handler.py b/backend/src/handler/sgdb_handler.py index b16c59ae1..647a9849b 100644 --- a/backend/src/handler/sgdb_handler.py +++ b/backend/src/handler/sgdb_handler.py @@ -1,5 +1,3 @@ -import os - import requests from config.config import STEAMGRIDDB_API_KEY diff --git a/backend/src/main.py b/backend/src/main.py index 6d6ae5f3d..253020eb9 100644 --- a/backend/src/main.py +++ b/backend/src/main.py @@ -1,14 +1,11 @@ -from dataclasses import asdict - -from fastapi import FastAPI +from fastapi import FastAPI, Request import uvicorn from logger.logger import log from handler.igdb_handler import IGDBHandler from handler.sgdb_handler import SGDBHandler from handler.db_handler import DBHandler -from config.config import PORT, HOST, DEFAULT_LOGO_URL, DEFAULT_COVER_URL_BIG, DEFAULT_COVER_URL_SMALL -from data.data import Platform, Rom +from config.config import DEV_PORT, DEV_HOST from utils import fs, fastapi @@ -16,78 +13,90 @@ app = FastAPI() fastapi.allow_cors(app) igdbh: IGDBHandler = IGDBHandler() +sgdbh: SGDBHandler = SGDBHandler() dbh: DBHandler = DBHandler() -@app.get("/platforms/{slug}/roms") -async def platforms(slug): - """Returns roms data of the desired platform""" - return {'data': [Rom(*r) for r in dbh.get_roms(slug)]} +@app.patch("/platforms/{p_slug}/roms/{filename}") +async def updateRom(req: Request, p_slug: str, filename: str): + """Updates rom details""" + + data: dict = await req.json() + if 'r_igdb_id' in data: + r_igdb_id, filename_no_ext, r_slug, r_name, summary, url_cover = igdbh.get_rom_details(filename, data['p_igdb_id'], data['r_igdb_id']) + path_cover_s, path_cover_l, has_cover = fs.get_cover_details(True, p_slug, filename_no_ext, url_cover) + data['r_igdb_id'] = r_igdb_id + data['filename_no_ext'] = filename_no_ext + data['r_slug'] = r_slug + data['name'] = r_name + data['summary'] = summary + data['path_cover_s'] = path_cover_s + data['path_cover_l'] = path_cover_l + data['has_cover'] = has_cover + data['p_slug'] = p_slug + else: + fs.rename_rom(p_slug, filename, data) + data['filename_no_ext'] = data['filename'].split('.')[0] + dbh.update_rom(p_slug, filename, data) + return {'data': data} + + +@app.delete("/platforms/{p_slug}/roms/{filename}") +async def delete_rom(p_slug: str, filename: str): + """Detele rom from filesystem and database""" + + log.info("deleting rom...") + fs.delete_rom(p_slug, filename) + dbh.delete_rom(p_slug, filename) + return {'msg': 'success'} + + +@app.get("/platforms/{p_slug}/roms/{filename}") +async def rom(p_slug: str, filename: str): + """Returns one rom data of the desired platform""" + + return {'data': dbh.get_rom(p_slug, filename)} + + +@app.get("/platforms/{p_slug}/roms") +async def roms(p_slug: str): + """Returns all roms of the desired platform""" + + return {'data': dbh.get_roms(p_slug)} @app.get("/platforms") async def platforms(): """Returns platforms data""" - return {'data': [Platform(*p) for p in dbh.get_platforms()]} + + return {'data': dbh.get_platforms()} -@app.get("/scan") -async def scan(overwrite: bool=False): +@app.put("/scan") +async def scan(req: Request, overwrite: bool=False): """Scan platforms and roms and write them in database.""" - log.info("scaning...") - - if overwrite or not fs.platform_logo_exists('default'): - fs.store_platform_logo('default', DEFAULT_LOGO_URL) - if overwrite or not fs.rom_cover_exists('default', 'cover', 'big'): - fs.store_rom_cover('default', 'cover', DEFAULT_COVER_URL_BIG, 'big') - if overwrite or not fs.rom_cover_exists('default', 'cover', 'small'): - fs.store_rom_cover('default', 'cover', DEFAULT_COVER_URL_SMALL, 'small') - - platforms: list = [] - roms: list = [] - - for platform_slug in fs.get_platforms(): - platform_igdb_id, platform_name, url_logo = igdbh.get_platform_details(platform_slug) - platform_sgdb_id: str = "" - if not platform_name: platform_name = platform_slug - details: list = [platform_igdb_id, platform_sgdb_id, platform_slug, platform_name] - if (overwrite or not fs.platform_logo_exists(platform_slug)) and url_logo: - fs.store_platform_logo(platform_slug, url_logo) - if fs.platform_logo_exists(platform_slug): - details.append(fs.get_platform_logo_path(platform_slug)) - platforms.append(Platform(*details)) - - for rom_filename in fs.get_roms(platform_slug): - log.info(f"Getting {rom_filename} details") - rom_igdb_id, rom_slug, rom_name, summary, url_cover = igdbh.get_rom_details(rom_filename, platform_igdb_id) - rom_sgdb_id: str = "" - if not rom_name: rom_name = rom_filename - details: list = [rom_igdb_id, rom_sgdb_id, platform_igdb_id, platform_sgdb_id, rom_filename, rom_name, rom_slug, summary, platform_slug] - - if (overwrite or not fs.rom_cover_exists(platform_slug, rom_filename, 'big')) and url_cover: - fs.store_rom_cover(platform_slug, rom_filename, url_cover, 'big') - - if (overwrite or not fs.rom_cover_exists(platform_slug, rom_filename, 'small')) and url_cover: - fs.store_rom_cover(platform_slug, rom_filename, url_cover, 'small') - - if fs.rom_cover_exists(platform_slug, rom_filename, 'big'): - details.append(fs.get_rom_cover_path(platform_slug, rom_filename, 'big')) - - if fs.rom_cover_exists(platform_slug, rom_filename, 'small'): - details.append(fs.get_rom_cover_path(platform_slug, rom_filename, 'small')) - - roms.append(Rom(*details)) - - dbh.regenerate_platform_table(*asdict(Platform()).keys()) - dbh.write_platforms(platforms) - - dbh.regenerate_rom_table(*asdict(Rom()).keys()) - dbh.write_roms(roms) - + log.info("complete scaning...") + fs.store_default_resources(overwrite) + data: dict = await req.json() + platforms = data['platforms'] if data['platforms'] else fs.get_platforms() + for p_slug in platforms: + p_igdb_id: str = fastapi.scan_platform(overwrite, p_slug, igdbh, dbh) + for filename in fs.get_roms(p_slug): + fastapi.scan_rom(overwrite, filename, p_igdb_id, p_slug, igdbh, dbh) + fastapi.purge(dbh, p_slug=p_slug) + fastapi.purge(dbh) return {'msg': 'success'} +@app.put("/search/roms/igdb") +async def search_rom_igdb(req: Request): + """Get all the roms matched from igdb.""" + + data: dict = await req.json() + log.info(f"getting {data['filename']} roms from {data['p_igdb_id']} igdb ...") + return {'data': igdbh.get_matched_roms(data['filename'], data['p_igdb_id'])} + + if __name__ == '__main__': - uvicorn.run("main:app", host=HOST, port=PORT, reload=True, workers=4) - dbh.close_conn() + uvicorn.run("main:app", host=DEV_HOST, port=DEV_PORT, reload=True) diff --git a/backend/src/data/__init__.py b/backend/src/models/__init__.py similarity index 100% rename from backend/src/data/__init__.py rename to backend/src/models/__init__.py diff --git a/backend/src/models/base.py b/backend/src/models/base.py new file mode 100644 index 000000000..dd57cff96 --- /dev/null +++ b/backend/src/models/base.py @@ -0,0 +1,11 @@ +from sqlalchemy import create_engine +from sqlalchemy.ext.declarative import declarative_base +from sqlalchemy.orm import sessionmaker + +from config.config import DB_HOST, DB_PORT, DB_USER, DB_PASSWD, DB_NAME + + +BaseModel = declarative_base() + +engine = create_engine(f"mariadb+mariadbconnector://{DB_USER}:{DB_PASSWD}@{DB_HOST}:{DB_PORT}/{DB_NAME}") +Session = sessionmaker(bind=engine, expire_on_commit=False) \ No newline at end of file diff --git a/backend/src/models/platform.py b/backend/src/models/platform.py new file mode 100644 index 000000000..b422de4a3 --- /dev/null +++ b/backend/src/models/platform.py @@ -0,0 +1,13 @@ +from sqlalchemy import Column, String + +from config.config import DEFAULT_PATH_LOGO +from models.base import BaseModel + + +class Platform(BaseModel): + __tablename__ = 'platforms' + igdb_id = Column(String(length=50), default="") + sgdb_id = Column(String(length=50), default="") + slug = Column(String(length=100), primary_key=True) + name = Column(String(length=200), default="") + path_logo = Column(String(length=500), default=DEFAULT_PATH_LOGO) diff --git a/backend/src/models/rom.py b/backend/src/models/rom.py new file mode 100644 index 000000000..5a3b77977 --- /dev/null +++ b/backend/src/models/rom.py @@ -0,0 +1,21 @@ +from sqlalchemy import Column, String, Text, Boolean + +from config.config import DEFAULT_PATH_COVER_S, DEFAULT_PATH_COVER_L +from models.base import BaseModel + + +class Rom(BaseModel): + __tablename__ = 'roms' + filename = Column(String(length=200), primary_key=True) + filename_no_ext = Column(String(length=200), default="") + r_igdb_id = Column(String(length=50), default="") + p_igdb_id = Column(String(length=50), default="") + r_sgdb_id = Column(String(length=50), default="") + p_sgdb_id = Column(String(length=50), default="") + name = Column(String(length=100), default="") + r_slug = Column(String(length=100), default="") + p_slug = Column(String(length=100), default="") + summary = Column(Text, default="") + path_cover_s = Column(String(length=500), default=DEFAULT_PATH_COVER_S) + path_cover_l = Column(String(length=500), default=DEFAULT_PATH_COVER_L) + has_cover = Column(Boolean, default=False) diff --git a/backend/src/utils/fastapi.py b/backend/src/utils/fastapi.py index c55271968..4b01af331 100644 --- a/backend/src/utils/fastapi.py +++ b/backend/src/utils/fastapi.py @@ -1,6 +1,9 @@ from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware +from handler.db_handler import DBHandler +from handler.igdb_handler import IGDBHandler +from utils import fs from logger.logger import log @@ -13,3 +16,53 @@ def allow_cors(app: FastAPI) -> None: allow_headers=["*"], ) log.info("CORS enabled") + + +def scan_platform(overwrite: bool, p_slug: str, igdbh: IGDBHandler, dbh: DBHandler) -> str: + platform: dict = {} + log.info(f"Getting {p_slug} details") + p_igdb_id, p_name, url_logo = igdbh.get_platform_details(p_slug) + platform['slug'] = p_slug + platform['igdb_id'] = p_igdb_id + platform['name'] = p_name + #TODO: refactor logo details logic + if (overwrite or not fs.p_logo_exists(p_slug)) and url_logo: + fs.store_p_logo(p_slug, url_logo) + if fs.p_logo_exists(p_slug): + platform['path_logo']: str = fs.get_p_path_logo(p_slug) + dbh.add_platform(**platform) + return p_igdb_id + + +def scan_rom(overwrite: bool, filename: str, p_igdb_id: str, p_slug: str, igdbh: IGDBHandler, dbh: DBHandler, r_igbd_id: str = '') -> None: + rom: dict = {} + log.info(f"Getting {filename} details") + r_igdb_id, filename_no_ext, r_slug, r_name, summary, url_cover = igdbh.get_rom_details(filename, p_igdb_id, r_igbd_id) + path_cover_s, path_cover_l, has_cover = fs.get_cover_details(overwrite, p_slug, filename_no_ext, url_cover) + rom['filename'] = filename + rom['filename_no_ext'] = filename_no_ext + rom['r_igdb_id'] = r_igdb_id + rom['p_igdb_id'] = p_igdb_id + rom['name'] = r_name + rom['r_slug'] = r_slug + rom['p_slug'] = p_slug + rom['summary'] = summary + rom['path_cover_s'] = path_cover_s + rom['path_cover_l'] = path_cover_l + rom['has_cover'] = has_cover + dbh.add_rom(**rom) + + +def purge(dbh: DBHandler, p_slug: str = '') -> None: + """Clean the database from non existent platforms or roms""" + if p_slug: + # Purge only roms in platform + roms: list = fs.get_roms(p_slug) + dbh.purge_roms(p_slug, roms) + else: + # Purge all platforms / delete non existent platforms and non existen roms + platforms: list = fs.get_platforms() + dbh.purge_platforms(platforms) + for p_slug in platforms: + roms: list = fs.get_roms(p_slug) + dbh.purge_roms(p_slug, roms) diff --git a/backend/src/utils/fs.py b/backend/src/utils/fs.py index ad7261a6b..c807d0e23 100644 --- a/backend/src/utils/fs.py +++ b/backend/src/utils/fs.py @@ -5,26 +5,27 @@ from pathlib import Path import requests from fastapi import HTTPException -from config.config import EMULATION_BASE_PATH +from config.config import EMULATION_BASE_PATH, DEFAULT_URL_LOGO, DEFAULT_URL_COVER_L, DEFAULT_PATH_COVER_L, DEFAULT_URL_COVER_S, DEFAULT_PATH_COVER_S from logger.logger import log -def get_platforms() -> list: - """Gets all filesystem platforms +# ========= Defaults utils ========= +def store_default_resources(overwrite: bool) -> None: + """Store default no_cover resources in the filesystem - Returns list with all the filesystem platforms found in the EMULATION_BASE_PATH. - Automatically discards the default directory. + Args: + overwrite: flag to overwrite or not default resources """ - try: - platforms: list = list(os.walk(EMULATION_BASE_PATH))[0][1] - if 'resources' in platforms: platforms.remove('resources') - log.info(f"filesystem platforms found: {platforms}") - return platforms - except IndexError: - raise HTTPException(status_code=404, detail="Platforms not found.") + if overwrite or not p_logo_exists('default'): + store_p_logo('default', DEFAULT_URL_LOGO) + if overwrite or not r_cover_exists('default', 'cover', 'l'): + store_r_cover('default', 'cover', DEFAULT_URL_COVER_L, 'l') + if overwrite or not r_cover_exists('default', 'cover', 's'): + store_r_cover('default', 'cover', DEFAULT_URL_COVER_S, 's') -def platform_logo_exists(slug: str) -> bool: +# ========= Platforms utils ========= +def p_logo_exists(slug: str) -> bool: """Check if platform logo exists in filesystem Args: @@ -36,11 +37,16 @@ def platform_logo_exists(slug: str) -> bool: return True if os.path.exists(logo_path) else False -def get_platform_logo_path(slug: str) -> str: +def get_p_path_logo(slug: str) -> str: + """Returns platform logo filesystem path + + Args: + slug: shor name of the platform + """ return f"/assets/emulation/resources/{slug}/logo.png" -def store_platform_logo(platform_slug: str, url_logo: str) -> None: +def store_p_logo(slug: str, url_logo: str) -> None: """Store platform resources in filesystem Args: @@ -48,65 +54,137 @@ def store_platform_logo(platform_slug: str, url_logo: str) -> None: url_logo: url to get logo """ logo_file: str = f"logo.png" - logo_path: str = f"{EMULATION_BASE_PATH}/resources/{platform_slug}" + logo_path: str = f"{EMULATION_BASE_PATH}/resources/{slug}" res = requests.get(url_logo, stream=True) if res.status_code == 200: Path(logo_path).mkdir(parents=True, exist_ok=True) with open(f"{logo_path}/{logo_file}", 'wb') as f: shutil.copyfileobj(res.raw, f) - log.info(f"{platform_slug} logo downloaded successfully!") + log.info(f"{slug} logo downloaded successfully!") else: - log.warning(f"{platform_slug} logo couldn't be downloaded") + log.warning(f"{slug} logo couldn't be downloaded") -def get_roms(platform_slug) -> list: - """Gets all filesystem roms for a platform +def get_platforms() -> list: + """Gets all filesystem platforms - Returns list with all the filesystem roms for a platform found in the EMULATION_BASE_PATH. + Returns list with all the filesystem platforms found in the EMULATION_BASE_PATH. Automatically discards the default directory. """ try: - roms: list = [] - roms = list(os.walk(f"{EMULATION_BASE_PATH}/{platform_slug}/roms/"))[0][2] - log.info(f"filesystem roms found for {platform_slug}: {roms}") + platforms: list[str] = list(os.walk(EMULATION_BASE_PATH))[0][1] + if 'resources' in platforms: platforms.remove('resources') + log.info(f"filesystem platforms found: {platforms}") + return platforms except IndexError: - log.warning(f"roms not found for {platform_slug}") - pass - return roms + raise HTTPException(status_code=404, detail="Platforms not found.") -def rom_cover_exists(platform_slug: str, rom_filename: str, size: str) -> bool: +# ========= Roms utils ========= +def r_cover_exists(p_slug: str, filename_no_ext: str, size: str) -> bool: """Check if rom cover exists in filesystem Args: - slug: short name of the platform - rom_filename: name of rom file + p_slug: short name of the platform + filename_no_ext: name of rom file without extension + size: size of the cover -> big as 'l' | small as 's' Returns True if cover exists in filesystem else False """ - logo_path: str = f"{EMULATION_BASE_PATH}/resources/{platform_slug}/{rom_filename.split('.')[0]}_{size}.png" + logo_path: str = f"{EMULATION_BASE_PATH}/resources/{p_slug}/{filename_no_ext}_{size}.png" return True if os.path.exists(logo_path) else False -def get_rom_cover_path(platform_slug: str, rom_filename: str, size: str) -> str: - return f"/assets/emulation/resources/{platform_slug}/{rom_filename.split('.')[0]}_{size}.png" +def get_r_cover_path(p_slug: str, filename_no_ext: str, size: str) -> str: + """Returns platform logo filesystem path + + Args: + p_slug: short name of the platform + filename_no_ext: name of rom file without extension + size: size of the cover -> big as 'l' | small as 's' + """ + return f"/assets/emulation/resources/{p_slug}/{filename_no_ext}_{size}.png" -def store_rom_cover(platfom_slug: str, rom_filename: str, url_cover: str, size: str) -> None: +def store_r_cover(p_slug: str, filename_no_ext: str, url_cover: str, size: str) -> None: """Store roms resources in filesystem Args: - platform_slug: short name of the platform - rom_filename: name of rom file - url_cover: url to get cover + p_slug: short name of the platform + filename_no_ext: name of rom file without extension + url_cover: url to get the cover + size: size of the cover -> big as 'l' | small as 's' """ - cover_file: str = f"{rom_filename.split('.')[0]}_{size}.png" - cover_path: str = f"{EMULATION_BASE_PATH}/resources/{platfom_slug}/" - res = requests.get(url_cover.replace('t_thumb', f't_cover_{size}'), stream=True) + cover_file: str = f"{filename_no_ext}_{size}.png" + cover_path: str = f"{EMULATION_BASE_PATH}/resources/{p_slug}/" + sizes: dict = {'l': 'big', 's': 'small'} + res = requests.get(url_cover.replace('t_thumb', f't_cover_{sizes[size]}'), stream=True) if res.status_code == 200: Path(cover_path).mkdir(parents=True, exist_ok=True) with open(f"{cover_path}/{cover_file}", 'wb') as f: shutil.copyfileobj(res.raw, f) - log.info(f"{rom_filename} {size} cover downloaded successfully!") + log.info(f"{filename_no_ext} {sizes[size]} cover downloaded successfully!") else: - log.warning(f"{rom_filename} {size} cover couldn't be downloaded") \ No newline at end of file + log.warning(f"{filename_no_ext} {sizes[size]} cover couldn't be downloaded") + + +def get_cover_details(overwrite: bool, p_slug: str, filename_no_ext: str, url_cover: str) -> tuple: + path_cover_s: str = DEFAULT_PATH_COVER_S + path_cover_l: str = DEFAULT_PATH_COVER_L + has_cover: int = 0 + if (overwrite or not r_cover_exists(p_slug, filename_no_ext, 's')) and url_cover: + store_r_cover(p_slug, filename_no_ext, url_cover, 's') + if r_cover_exists(p_slug, filename_no_ext, 's'): + path_cover_s = get_r_cover_path(p_slug, filename_no_ext, 's') + + if (overwrite or not r_cover_exists(p_slug, filename_no_ext, 'l')) and url_cover: + store_r_cover(p_slug, filename_no_ext, url_cover, 'l') + if r_cover_exists(p_slug, filename_no_ext, 'l'): + path_cover_l = get_r_cover_path(p_slug, filename_no_ext, 'l') + has_cover = 1 + return path_cover_s, path_cover_l, has_cover + + +def get_roms(p_slug: str) -> list: + """Gets all filesystem roms for a platform + + Args: + p_slug: short name of the platform + Returns: list with all the filesystem roms for a platform found in the EMULATION_BASE_PATH. + Automatically discards the default directory. + """ + try: + roms: list[str] = [] + roms = list(os.walk(f"{EMULATION_BASE_PATH}/{p_slug}/roms/"))[0][2] + log.info(f"filesystem roms found for {p_slug}: {roms}") + except IndexError: + log.warning(f"roms not found for {p_slug}") + pass + return roms + + +def r_exists(p_slug: str, filename: str) -> bool: + """Check if rom exists in filesystem + + Args: + p_slug: short name of the platform + filename: rom filename + Returns + True if rom exists in filesystem else False + """ + rom_path: str = f"{EMULATION_BASE_PATH}/{p_slug}/roms/{filename}" + exists: bool = True if os.path.exists(rom_path) else False + return exists + + +def rename_rom(p_slug: str, filename: str, data: dict) -> None: + if r_exists(p_slug, data['filename']): raise HTTPException(status_code=500, detail=f"Can't rename: {data['filename']} already exists.") + os.rename(f"{EMULATION_BASE_PATH}/{p_slug}/roms/{filename}", + f"{EMULATION_BASE_PATH}/{p_slug}/roms/{data['filename']}") + + +def delete_rom(p_slug: str, filename: str) -> None: + try: + os.remove(f"{EMULATION_BASE_PATH}/{p_slug}/roms/{filename}") + except FileNotFoundError: + log.warning(f"Rom not found in filesystem: {p_slug}/{filename}") diff --git a/docker/Dockerfile b/docker/Dockerfile index 263191f7c..879e66bc3 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -9,6 +9,7 @@ RUN npm run build # setup frontend FROM ubuntu/nginx:1.18-22.04_edge as production-stage COPY --from=front-build-stage /front/dist /var/www/html +COPY ./frontend/assets/platforms /var/www/html/assets/platforms RUN ln -s /emulation /var/www/html/assets/emulation # setup backend diff --git a/docker/nginx/default.conf b/docker/nginx/default.conf index 1c9f2509e..4623ea5a4 100644 --- a/docker/nginx/default.conf +++ b/docker/nginx/default.conf @@ -37,6 +37,11 @@ http { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; + location / { + try_files $uri $uri/ /index.html; + proxy_redirect off; + } + # Backend api calls location /api { rewrite /api/(.*) /$1 break; diff --git a/emulation/gb/roms/pokemon azul.gb b/emulation/3ds/roms/Metroid - Samus Returns.3ds similarity index 100% rename from emulation/gb/roms/pokemon azul.gb rename to emulation/3ds/roms/Metroid - Samus Returns.3ds diff --git a/emulation/gb/roms/pokemon red.gb b/emulation/3ds/roms/pokemon moon.3ds similarity index 100% rename from emulation/gb/roms/pokemon red.gb rename to emulation/3ds/roms/pokemon moon.3ds diff --git a/emulation/gba/roms/castlevania - aria of sorrow.gba b/emulation/3ds/roms/pokemon sun.3ds similarity index 100% rename from emulation/gba/roms/castlevania - aria of sorrow.gba rename to emulation/3ds/roms/pokemon sun.3ds diff --git a/emulation/nds/roms/romm.nds b/emulation/3ds/roms/pokemon ultra moon.3ds similarity index 100% rename from emulation/nds/roms/romm.nds rename to emulation/3ds/roms/pokemon ultra moon.3ds diff --git a/emulation/3ds/roms/pokemon ultra sun.3ds b/emulation/3ds/roms/pokemon ultra sun.3ds new file mode 100644 index 000000000..e69de29bb diff --git a/emulation/3ds/roms/pokemon x.3ds b/emulation/3ds/roms/pokemon x.3ds new file mode 100644 index 000000000..e69de29bb diff --git a/emulation/3ds/roms/pokemon y.3ds b/emulation/3ds/roms/pokemon y.3ds new file mode 100644 index 000000000..e69de29bb diff --git a/emulation/3ds/roms/zelda majoras mask.3ds b/emulation/3ds/roms/zelda majoras mask.3ds new file mode 100644 index 000000000..e69de29bb diff --git a/emulation/3ds/roms/zelda.3ds b/emulation/3ds/roms/zelda.3ds new file mode 100644 index 000000000..e69de29bb diff --git a/emulation/gb/roms/pokemon blue.gb b/emulation/gb/roms/pokemon blue.gb new file mode 100644 index 000000000..e69de29bb diff --git a/emulation/gb/roms/pokemon yellow.gb b/emulation/gb/roms/pokemon yellow.gb new file mode 100644 index 000000000..e69de29bb diff --git a/emulation/gb/roms/romm.gb b/emulation/gb/roms/romm.gb new file mode 100644 index 000000000..e69de29bb diff --git a/emulation/gba/roms/pokemon emerald.gba b/emulation/gba/roms/pokemon emerald.gba new file mode 100644 index 000000000..e69de29bb diff --git a/emulation/gba/roms/pokemon leafgreen.gba b/emulation/gba/roms/pokemon leafgreen.gba new file mode 100644 index 000000000..e69de29bb diff --git a/emulation/gbc/roms/pokemon gold.gbc b/emulation/gbc/roms/pokemon gold.gbc new file mode 100644 index 000000000..e69de29bb diff --git a/emulation/gbc/roms/pokemon silver.gbc b/emulation/gbc/roms/pokemon silver.gbc new file mode 100644 index 000000000..e69de29bb diff --git a/emulation/nds/roms/pokemon black 2.nds b/emulation/nds/roms/pokemon black 2.nds new file mode 100644 index 000000000..e69de29bb diff --git a/emulation/nds/roms/pokemon black.nds b/emulation/nds/roms/pokemon black.nds new file mode 100644 index 000000000..e69de29bb diff --git a/emulation/nds/roms/pokemon white 2.nds b/emulation/nds/roms/pokemon white 2.nds new file mode 100644 index 000000000..e69de29bb diff --git a/emulation/nds/roms/pokemon white.nds b/emulation/nds/roms/pokemon white.nds new file mode 100644 index 000000000..e69de29bb diff --git a/emulation/nes/roms/castlevania.nes b/emulation/nes/roms/castlevania.nes new file mode 100644 index 000000000..e69de29bb diff --git a/emulation/resources/3ds/Metroid - Samus Returns_l.png b/emulation/resources/3ds/Metroid - Samus Returns_l.png new file mode 100644 index 000000000..0898cfe78 Binary files /dev/null and b/emulation/resources/3ds/Metroid - Samus Returns_l.png differ diff --git a/emulation/resources/3ds/Metroid - Samus Returns_s.png b/emulation/resources/3ds/Metroid - Samus Returns_s.png new file mode 100644 index 000000000..2027cbd7c Binary files /dev/null and b/emulation/resources/3ds/Metroid - Samus Returns_s.png differ diff --git a/emulation/resources/3ds/logo.png b/emulation/resources/3ds/logo.png new file mode 100644 index 000000000..ecf62156e Binary files /dev/null and b/emulation/resources/3ds/logo.png differ diff --git a/emulation/resources/3ds/pokemon alpha saphire_l.png b/emulation/resources/3ds/pokemon alpha saphire_l.png new file mode 100644 index 000000000..13594c4b4 Binary files /dev/null and b/emulation/resources/3ds/pokemon alpha saphire_l.png differ diff --git a/emulation/resources/3ds/pokemon alpha saphire_s.png b/emulation/resources/3ds/pokemon alpha saphire_s.png new file mode 100644 index 000000000..b66b0b55c Binary files /dev/null and b/emulation/resources/3ds/pokemon alpha saphire_s.png differ diff --git a/emulation/resources/3ds/pokemon alpha_l.png b/emulation/resources/3ds/pokemon alpha_l.png new file mode 100644 index 000000000..13594c4b4 Binary files /dev/null and b/emulation/resources/3ds/pokemon alpha_l.png differ diff --git a/emulation/resources/3ds/pokemon alpha_s.png b/emulation/resources/3ds/pokemon alpha_s.png new file mode 100644 index 000000000..b66b0b55c Binary files /dev/null and b/emulation/resources/3ds/pokemon alpha_s.png differ diff --git a/emulation/resources/3ds/pokemon moon_l.png b/emulation/resources/3ds/pokemon moon_l.png new file mode 100644 index 000000000..23964c53b Binary files /dev/null and b/emulation/resources/3ds/pokemon moon_l.png differ diff --git a/emulation/resources/3ds/pokemon moon_s.png b/emulation/resources/3ds/pokemon moon_s.png new file mode 100644 index 000000000..d6df4e082 Binary files /dev/null and b/emulation/resources/3ds/pokemon moon_s.png differ diff --git a/emulation/resources/3ds/pokemon omega ruby_l.png b/emulation/resources/3ds/pokemon omega ruby_l.png new file mode 100644 index 000000000..443d42194 Binary files /dev/null and b/emulation/resources/3ds/pokemon omega ruby_l.png differ diff --git a/emulation/resources/3ds/pokemon omega ruby_s.png b/emulation/resources/3ds/pokemon omega ruby_s.png new file mode 100644 index 000000000..f6f839260 Binary files /dev/null and b/emulation/resources/3ds/pokemon omega ruby_s.png differ diff --git a/emulation/resources/3ds/pokemon ruby_l.png b/emulation/resources/3ds/pokemon ruby_l.png new file mode 100644 index 000000000..443d42194 Binary files /dev/null and b/emulation/resources/3ds/pokemon ruby_l.png differ diff --git a/emulation/resources/3ds/pokemon ruby_s.png b/emulation/resources/3ds/pokemon ruby_s.png new file mode 100644 index 000000000..f6f839260 Binary files /dev/null and b/emulation/resources/3ds/pokemon ruby_s.png differ diff --git a/emulation/resources/3ds/pokemon sun_l.png b/emulation/resources/3ds/pokemon sun_l.png new file mode 100644 index 000000000..99d4084cc Binary files /dev/null and b/emulation/resources/3ds/pokemon sun_l.png differ diff --git a/emulation/resources/3ds/pokemon sun_s.png b/emulation/resources/3ds/pokemon sun_s.png new file mode 100644 index 000000000..ff6a77601 Binary files /dev/null and b/emulation/resources/3ds/pokemon sun_s.png differ diff --git a/emulation/resources/3ds/pokemon ultra moon_l.png b/emulation/resources/3ds/pokemon ultra moon_l.png new file mode 100644 index 000000000..23964c53b Binary files /dev/null and b/emulation/resources/3ds/pokemon ultra moon_l.png differ diff --git a/emulation/resources/3ds/pokemon ultra moon_s.png b/emulation/resources/3ds/pokemon ultra moon_s.png new file mode 100644 index 000000000..d6df4e082 Binary files /dev/null and b/emulation/resources/3ds/pokemon ultra moon_s.png differ diff --git a/emulation/resources/3ds/pokemon ultra sun_l.png b/emulation/resources/3ds/pokemon ultra sun_l.png new file mode 100644 index 000000000..1e9392c4b Binary files /dev/null and b/emulation/resources/3ds/pokemon ultra sun_l.png differ diff --git a/emulation/resources/3ds/pokemon ultra sun_s.png b/emulation/resources/3ds/pokemon ultra sun_s.png new file mode 100644 index 000000000..0f8d98705 Binary files /dev/null and b/emulation/resources/3ds/pokemon ultra sun_s.png differ diff --git a/emulation/resources/3ds/pokemon ultra_l.png b/emulation/resources/3ds/pokemon ultra_l.png new file mode 100644 index 000000000..23964c53b Binary files /dev/null and b/emulation/resources/3ds/pokemon ultra_l.png differ diff --git a/emulation/resources/3ds/pokemon ultra_s.png b/emulation/resources/3ds/pokemon ultra_s.png new file mode 100644 index 000000000..d6df4e082 Binary files /dev/null and b/emulation/resources/3ds/pokemon ultra_s.png differ diff --git a/emulation/resources/3ds/pokemon x_l.png b/emulation/resources/3ds/pokemon x_l.png new file mode 100644 index 000000000..2053ebd3e Binary files /dev/null and b/emulation/resources/3ds/pokemon x_l.png differ diff --git a/emulation/resources/3ds/pokemon x_s.png b/emulation/resources/3ds/pokemon x_s.png new file mode 100644 index 000000000..a5b2d1fd5 Binary files /dev/null and b/emulation/resources/3ds/pokemon x_s.png differ diff --git a/emulation/resources/3ds/pokemon y_l.png b/emulation/resources/3ds/pokemon y_l.png new file mode 100644 index 000000000..949bd0970 Binary files /dev/null and b/emulation/resources/3ds/pokemon y_l.png differ diff --git a/emulation/resources/3ds/pokemon y_s.png b/emulation/resources/3ds/pokemon y_s.png new file mode 100644 index 000000000..8b9c884cf Binary files /dev/null and b/emulation/resources/3ds/pokemon y_s.png differ diff --git a/emulation/resources/3ds/pokemon_l.png b/emulation/resources/3ds/pokemon_l.png new file mode 100644 index 000000000..99d4084cc Binary files /dev/null and b/emulation/resources/3ds/pokemon_l.png differ diff --git a/emulation/resources/3ds/pokemon_s.png b/emulation/resources/3ds/pokemon_s.png new file mode 100644 index 000000000..ff6a77601 Binary files /dev/null and b/emulation/resources/3ds/pokemon_s.png differ diff --git a/emulation/resources/3ds/zelda majoras mask_l.png b/emulation/resources/3ds/zelda majoras mask_l.png new file mode 100644 index 000000000..2c5813461 Binary files /dev/null and b/emulation/resources/3ds/zelda majoras mask_l.png differ diff --git a/emulation/resources/3ds/zelda majoras mask_s.png b/emulation/resources/3ds/zelda majoras mask_s.png new file mode 100644 index 000000000..13cd326e5 Binary files /dev/null and b/emulation/resources/3ds/zelda majoras mask_s.png differ diff --git a/emulation/resources/3ds/zelda ocarina of time_l.png b/emulation/resources/3ds/zelda ocarina of time_l.png new file mode 100644 index 000000000..3033c86b4 Binary files /dev/null and b/emulation/resources/3ds/zelda ocarina of time_l.png differ diff --git a/emulation/resources/3ds/zelda ocarina of time_s.png b/emulation/resources/3ds/zelda ocarina of time_s.png new file mode 100644 index 000000000..199e3415b Binary files /dev/null and b/emulation/resources/3ds/zelda ocarina of time_s.png differ diff --git a/emulation/resources/3ds/zelda_l.png b/emulation/resources/3ds/zelda_l.png new file mode 100644 index 000000000..3033c86b4 Binary files /dev/null and b/emulation/resources/3ds/zelda_l.png differ diff --git a/emulation/resources/3ds/zelda_s.png b/emulation/resources/3ds/zelda_s.png new file mode 100644 index 000000000..199e3415b Binary files /dev/null and b/emulation/resources/3ds/zelda_s.png differ diff --git a/emulation/resources/default/cover_big.png b/emulation/resources/default/cover_l.png similarity index 100% rename from emulation/resources/default/cover_big.png rename to emulation/resources/default/cover_l.png diff --git a/emulation/resources/default/cover_small.png b/emulation/resources/default/cover_s.png similarity index 100% rename from emulation/resources/default/cover_small.png rename to emulation/resources/default/cover_s.png diff --git a/emulation/resources/gb/pokemon azul_big.png b/emulation/resources/gb/pokemon azul_l.png similarity index 100% rename from emulation/resources/gb/pokemon azul_big.png rename to emulation/resources/gb/pokemon azul_l.png diff --git a/emulation/resources/gb/pokemon azul_small.png b/emulation/resources/gb/pokemon azul_s.png similarity index 100% rename from emulation/resources/gb/pokemon azul_small.png rename to emulation/resources/gb/pokemon azul_s.png diff --git a/emulation/resources/gb/pokemon blue_l.png b/emulation/resources/gb/pokemon blue_l.png new file mode 100644 index 000000000..79be50336 Binary files /dev/null and b/emulation/resources/gb/pokemon blue_l.png differ diff --git a/emulation/resources/gb/pokemon blue_s.png b/emulation/resources/gb/pokemon blue_s.png new file mode 100644 index 000000000..193f87369 Binary files /dev/null and b/emulation/resources/gb/pokemon blue_s.png differ diff --git a/emulation/resources/gb/pokemon red_big.png b/emulation/resources/gb/pokemon red_l.png similarity index 100% rename from emulation/resources/gb/pokemon red_big.png rename to emulation/resources/gb/pokemon red_l.png diff --git a/emulation/resources/gb/pokemon red_small.png b/emulation/resources/gb/pokemon red_s.png similarity index 100% rename from emulation/resources/gb/pokemon red_small.png rename to emulation/resources/gb/pokemon red_s.png diff --git a/emulation/resources/gb/pokemon yellow_l.png b/emulation/resources/gb/pokemon yellow_l.png new file mode 100644 index 000000000..320e3b2e6 Binary files /dev/null and b/emulation/resources/gb/pokemon yellow_l.png differ diff --git a/emulation/resources/gb/pokemon yellow_s.png b/emulation/resources/gb/pokemon yellow_s.png new file mode 100644 index 000000000..6f888c73b Binary files /dev/null and b/emulation/resources/gb/pokemon yellow_s.png differ diff --git a/emulation/resources/gb/pokemon_l.png b/emulation/resources/gb/pokemon_l.png new file mode 100644 index 000000000..a5917df53 Binary files /dev/null and b/emulation/resources/gb/pokemon_l.png differ diff --git a/emulation/resources/gb/pokemon_s.png b/emulation/resources/gb/pokemon_s.png new file mode 100644 index 000000000..0754cfb37 Binary files /dev/null and b/emulation/resources/gb/pokemon_s.png differ diff --git a/emulation/resources/gba/Need for Speed Underground 2_big.png b/emulation/resources/gba/Need for Speed Underground 2_l.png similarity index 100% rename from emulation/resources/gba/Need for Speed Underground 2_big.png rename to emulation/resources/gba/Need for Speed Underground 2_l.png diff --git a/emulation/resources/gba/Need for Speed Underground 2_small.png b/emulation/resources/gba/Need for Speed Underground 2_s.png similarity index 100% rename from emulation/resources/gba/Need for Speed Underground 2_small.png rename to emulation/resources/gba/Need for Speed Underground 2_s.png diff --git a/emulation/resources/gba/castlevania - aria of sorrow_big.png b/emulation/resources/gba/castlevania - aria of sorrow_l.png similarity index 100% rename from emulation/resources/gba/castlevania - aria of sorrow_big.png rename to emulation/resources/gba/castlevania - aria of sorrow_l.png diff --git a/emulation/resources/gba/castlevania - aria of sorrow_small.png b/emulation/resources/gba/castlevania - aria of sorrow_s.png similarity index 100% rename from emulation/resources/gba/castlevania - aria of sorrow_small.png rename to emulation/resources/gba/castlevania - aria of sorrow_s.png diff --git a/emulation/resources/gba/castlevania - aria of sorrows_l.png b/emulation/resources/gba/castlevania - aria of sorrows_l.png new file mode 100644 index 000000000..0b506e2e7 Binary files /dev/null and b/emulation/resources/gba/castlevania - aria of sorrows_l.png differ diff --git a/emulation/resources/gba/castlevania - aria of sorrows_s.png b/emulation/resources/gba/castlevania - aria of sorrows_s.png new file mode 100644 index 000000000..b84bbbc40 Binary files /dev/null and b/emulation/resources/gba/castlevania - aria of sorrows_s.png differ diff --git a/emulation/resources/gba/pokemon emerald_l.png b/emulation/resources/gba/pokemon emerald_l.png new file mode 100644 index 000000000..f88ea512a Binary files /dev/null and b/emulation/resources/gba/pokemon emerald_l.png differ diff --git a/emulation/resources/gba/pokemon emerald_s.png b/emulation/resources/gba/pokemon emerald_s.png new file mode 100644 index 000000000..ef812b06c Binary files /dev/null and b/emulation/resources/gba/pokemon emerald_s.png differ diff --git a/emulation/resources/gba/pokemon firered_big.png b/emulation/resources/gba/pokemon firered_l.png similarity index 100% rename from emulation/resources/gba/pokemon firered_big.png rename to emulation/resources/gba/pokemon firered_l.png diff --git a/emulation/resources/gba/pokemon firered_small.png b/emulation/resources/gba/pokemon firered_s.png similarity index 100% rename from emulation/resources/gba/pokemon firered_small.png rename to emulation/resources/gba/pokemon firered_s.png diff --git a/emulation/resources/gba/pokemon leafgreen_l.png b/emulation/resources/gba/pokemon leafgreen_l.png new file mode 100644 index 000000000..a91dc7a96 Binary files /dev/null and b/emulation/resources/gba/pokemon leafgreen_l.png differ diff --git a/emulation/resources/gba/pokemon leafgreen_s.png b/emulation/resources/gba/pokemon leafgreen_s.png new file mode 100644 index 000000000..944ed2fdf Binary files /dev/null and b/emulation/resources/gba/pokemon leafgreen_s.png differ diff --git a/emulation/resources/gba/pokemon ruby_big.png b/emulation/resources/gba/pokemon ruby_l.png similarity index 100% rename from emulation/resources/gba/pokemon ruby_big.png rename to emulation/resources/gba/pokemon ruby_l.png diff --git a/emulation/resources/gba/pokemon ruby_small.png b/emulation/resources/gba/pokemon ruby_s.png similarity index 100% rename from emulation/resources/gba/pokemon ruby_small.png rename to emulation/resources/gba/pokemon ruby_s.png diff --git a/emulation/resources/gba/pokemon sapphire_big.png b/emulation/resources/gba/pokemon sapphire_l.png similarity index 100% rename from emulation/resources/gba/pokemon sapphire_big.png rename to emulation/resources/gba/pokemon sapphire_l.png diff --git a/emulation/resources/gba/pokemon sapphire_small.png b/emulation/resources/gba/pokemon sapphire_s.png similarity index 100% rename from emulation/resources/gba/pokemon sapphire_small.png rename to emulation/resources/gba/pokemon sapphire_s.png diff --git a/emulation/resources/gba/wario land 4_big.png b/emulation/resources/gba/wario land 4_l.png similarity index 100% rename from emulation/resources/gba/wario land 4_big.png rename to emulation/resources/gba/wario land 4_l.png diff --git a/emulation/resources/gba/wario land 4_small.png b/emulation/resources/gba/wario land 4_s.png similarity index 100% rename from emulation/resources/gba/wario land 4_small.png rename to emulation/resources/gba/wario land 4_s.png diff --git a/emulation/resources/gbc/4x4 World Trophy_big.png b/emulation/resources/gbc/4x4 World Trophy_big.png deleted file mode 100644 index c2818d93d..000000000 Binary files a/emulation/resources/gbc/4x4 World Trophy_big.png and /dev/null differ diff --git a/emulation/resources/gbc/4x4 World Trophy_small.png b/emulation/resources/gbc/4x4 World Trophy_small.png deleted file mode 100644 index 0c07ea4d4..000000000 Binary files a/emulation/resources/gbc/4x4 World Trophy_small.png and /dev/null differ diff --git a/emulation/resources/gbc/Gremlins Unleashed_big.png b/emulation/resources/gbc/Gremlins Unleashed_big.png deleted file mode 100644 index b58010ccd..000000000 Binary files a/emulation/resources/gbc/Gremlins Unleashed_big.png and /dev/null differ diff --git a/emulation/resources/gbc/Gremlins Unleashed_small.png b/emulation/resources/gbc/Gremlins Unleashed_small.png deleted file mode 100644 index 490d3f769..000000000 Binary files a/emulation/resources/gbc/Gremlins Unleashed_small.png and /dev/null differ diff --git a/emulation/resources/gbc/Harry Potter - The secret chamber_big.png b/emulation/resources/gbc/Harry Potter - The secret chamber_big.png deleted file mode 100644 index 471d4d381..000000000 Binary files a/emulation/resources/gbc/Harry Potter - The secret chamber_big.png and /dev/null differ diff --git a/emulation/resources/gbc/Harry Potter - The secret chamber_small.png b/emulation/resources/gbc/Harry Potter - The secret chamber_small.png deleted file mode 100644 index 6ef9ae29e..000000000 Binary files a/emulation/resources/gbc/Harry Potter - The secret chamber_small.png and /dev/null differ diff --git a/emulation/resources/gbc/Harry Potter - The sorcerer stone_big.png b/emulation/resources/gbc/Harry Potter - The sorcerer stone_big.png deleted file mode 100644 index 31a54880c..000000000 Binary files a/emulation/resources/gbc/Harry Potter - The sorcerer stone_big.png and /dev/null differ diff --git a/emulation/resources/gbc/Harry Potter - The sorcerer stone_small.png b/emulation/resources/gbc/Harry Potter - The sorcerer stone_small.png deleted file mode 100644 index ba06b33e9..000000000 Binary files a/emulation/resources/gbc/Harry Potter - The sorcerer stone_small.png and /dev/null differ diff --git a/emulation/resources/gbc/Pokemon Trading Card Game_big.png b/emulation/resources/gbc/Pokemon Trading Card Game_big.png deleted file mode 100644 index 7580bf227..000000000 Binary files a/emulation/resources/gbc/Pokemon Trading Card Game_big.png and /dev/null differ diff --git a/emulation/resources/gbc/Pokemon Trading Card Game_small.png b/emulation/resources/gbc/Pokemon Trading Card Game_small.png deleted file mode 100644 index c042fe0df..000000000 Binary files a/emulation/resources/gbc/Pokemon Trading Card Game_small.png and /dev/null differ diff --git a/emulation/resources/gbc/Rampage - World Tour_big.png b/emulation/resources/gbc/Rampage - World Tour_big.png deleted file mode 100644 index 05f148e84..000000000 Binary files a/emulation/resources/gbc/Rampage - World Tour_big.png and /dev/null differ diff --git a/emulation/resources/gbc/Rampage - World Tour_small.png b/emulation/resources/gbc/Rampage - World Tour_small.png deleted file mode 100644 index d44a72c34..000000000 Binary files a/emulation/resources/gbc/Rampage - World Tour_small.png and /dev/null differ diff --git a/emulation/resources/gbc/Tarzan_big.png b/emulation/resources/gbc/Tarzan_big.png deleted file mode 100644 index d49d90a40..000000000 Binary files a/emulation/resources/gbc/Tarzan_big.png and /dev/null differ diff --git a/emulation/resources/gbc/Tarzan_small.png b/emulation/resources/gbc/Tarzan_small.png deleted file mode 100644 index b55fa68b7..000000000 Binary files a/emulation/resources/gbc/Tarzan_small.png and /dev/null differ diff --git a/emulation/resources/gbc/The Legend of Zelda - Oracle of Seasons_big.png b/emulation/resources/gbc/The Legend of Zelda - Oracle of Seasons_big.png deleted file mode 100644 index 37c174c80..000000000 Binary files a/emulation/resources/gbc/The Legend of Zelda - Oracle of Seasons_big.png and /dev/null differ diff --git a/emulation/resources/gbc/The Legend of Zelda - Oracle of Seasons_small.png b/emulation/resources/gbc/The Legend of Zelda - Oracle of Seasons_small.png deleted file mode 100644 index 27a3a243a..000000000 Binary files a/emulation/resources/gbc/The Legend of Zelda - Oracle of Seasons_small.png and /dev/null differ diff --git a/emulation/resources/gbc/The Legend of Zelda - Oracle of ages_big.png b/emulation/resources/gbc/The Legend of Zelda - Oracle of ages_big.png deleted file mode 100644 index 32975a267..000000000 Binary files a/emulation/resources/gbc/The Legend of Zelda - Oracle of ages_big.png and /dev/null differ diff --git a/emulation/resources/gbc/The Legend of Zelda - Oracle of ages_small.png b/emulation/resources/gbc/The Legend of Zelda - Oracle of ages_small.png deleted file mode 100644 index ddc48a9cf..000000000 Binary files a/emulation/resources/gbc/The Legend of Zelda - Oracle of ages_small.png and /dev/null differ diff --git a/emulation/resources/gbc/V-Rally - Championship Edition_big.png b/emulation/resources/gbc/V-Rally - Championship Edition_big.png deleted file mode 100644 index ea8a51ca5..000000000 Binary files a/emulation/resources/gbc/V-Rally - Championship Edition_big.png and /dev/null differ diff --git a/emulation/resources/gbc/V-Rally - Championship Edition_small.png b/emulation/resources/gbc/V-Rally - Championship Edition_small.png deleted file mode 100644 index 00d32cec1..000000000 Binary files a/emulation/resources/gbc/V-Rally - Championship Edition_small.png and /dev/null differ diff --git a/emulation/resources/gbc/Wario Land 3_big.png b/emulation/resources/gbc/Wario Land 3_big.png deleted file mode 100644 index 229699ada..000000000 Binary files a/emulation/resources/gbc/Wario Land 3_big.png and /dev/null differ diff --git a/emulation/resources/gbc/Wario Land 3_small.png b/emulation/resources/gbc/Wario Land 3_small.png deleted file mode 100644 index f88b8f172..000000000 Binary files a/emulation/resources/gbc/Wario Land 3_small.png and /dev/null differ diff --git a/emulation/resources/gbc/Pokemon crystal_big.png b/emulation/resources/gbc/pokemon crystal_l.png similarity index 100% rename from emulation/resources/gbc/Pokemon crystal_big.png rename to emulation/resources/gbc/pokemon crystal_l.png diff --git a/emulation/resources/gbc/Pokemon crystal_small.png b/emulation/resources/gbc/pokemon crystal_s.png similarity index 100% rename from emulation/resources/gbc/Pokemon crystal_small.png rename to emulation/resources/gbc/pokemon crystal_s.png diff --git a/emulation/resources/gbc/pokemon gold_big.png b/emulation/resources/gbc/pokemon gold_l.png similarity index 100% rename from emulation/resources/gbc/pokemon gold_big.png rename to emulation/resources/gbc/pokemon gold_l.png diff --git a/emulation/resources/gbc/pokemon gold_small.png b/emulation/resources/gbc/pokemon gold_s.png similarity index 100% rename from emulation/resources/gbc/pokemon gold_small.png rename to emulation/resources/gbc/pokemon gold_s.png diff --git a/emulation/resources/gbc/Pokemon plata_big.png b/emulation/resources/gbc/pokemon silver_l.png similarity index 100% rename from emulation/resources/gbc/Pokemon plata_big.png rename to emulation/resources/gbc/pokemon silver_l.png diff --git a/emulation/resources/gbc/Pokemon plata_small.png b/emulation/resources/gbc/pokemon silver_s.png similarity index 100% rename from emulation/resources/gbc/Pokemon plata_small.png rename to emulation/resources/gbc/pokemon silver_s.png diff --git a/emulation/resources/genesis-slash-megadrive/logo.png b/emulation/resources/genesis-slash-megadrive/logo.png new file mode 100644 index 000000000..95e6a6cb5 Binary files /dev/null and b/emulation/resources/genesis-slash-megadrive/logo.png differ diff --git a/emulation/resources/n64/super mario 64_big.png b/emulation/resources/n64/super mario 64_l.png similarity index 100% rename from emulation/resources/n64/super mario 64_big.png rename to emulation/resources/n64/super mario 64_l.png diff --git a/emulation/resources/n64/super mario 64_small.png b/emulation/resources/n64/super mario 64_s.png similarity index 100% rename from emulation/resources/n64/super mario 64_small.png rename to emulation/resources/n64/super mario 64_s.png diff --git a/emulation/resources/nds/castlevania - dawn of sorrow_big.png b/emulation/resources/nds/castlevania - dawn of sorrow_l.png similarity index 100% rename from emulation/resources/nds/castlevania - dawn of sorrow_big.png rename to emulation/resources/nds/castlevania - dawn of sorrow_l.png diff --git a/emulation/resources/nds/castlevania - dawn of sorrow_small.png b/emulation/resources/nds/castlevania - dawn of sorrow_s.png similarity index 100% rename from emulation/resources/nds/castlevania - dawn of sorrow_small.png rename to emulation/resources/nds/castlevania - dawn of sorrow_s.png diff --git a/emulation/resources/nds/castlevania - order of ecclesia_big.png b/emulation/resources/nds/castlevania - order of ecclesia_l.png similarity index 100% rename from emulation/resources/nds/castlevania - order of ecclesia_big.png rename to emulation/resources/nds/castlevania - order of ecclesia_l.png diff --git a/emulation/resources/nds/castlevania - order of ecclesia_small.png b/emulation/resources/nds/castlevania - order of ecclesia_s.png similarity index 100% rename from emulation/resources/nds/castlevania - order of ecclesia_small.png rename to emulation/resources/nds/castlevania - order of ecclesia_s.png diff --git a/emulation/resources/nds/pokemon black 2_l.png b/emulation/resources/nds/pokemon black 2_l.png new file mode 100644 index 000000000..b1880926a Binary files /dev/null and b/emulation/resources/nds/pokemon black 2_l.png differ diff --git a/emulation/resources/nds/pokemon black 2_s.png b/emulation/resources/nds/pokemon black 2_s.png new file mode 100644 index 000000000..3423f62ad Binary files /dev/null and b/emulation/resources/nds/pokemon black 2_s.png differ diff --git a/emulation/resources/nds/pokemon black_l.png b/emulation/resources/nds/pokemon black_l.png new file mode 100644 index 000000000..50266a818 Binary files /dev/null and b/emulation/resources/nds/pokemon black_l.png differ diff --git a/emulation/resources/nds/pokemon black_s.png b/emulation/resources/nds/pokemon black_s.png new file mode 100644 index 000000000..7d224dab3 Binary files /dev/null and b/emulation/resources/nds/pokemon black_s.png differ diff --git a/emulation/resources/nds/pokemon white 2_l.png b/emulation/resources/nds/pokemon white 2_l.png new file mode 100644 index 000000000..122231ebb Binary files /dev/null and b/emulation/resources/nds/pokemon white 2_l.png differ diff --git a/emulation/resources/nds/pokemon white 2_s.png b/emulation/resources/nds/pokemon white 2_s.png new file mode 100644 index 000000000..fe6863e3e Binary files /dev/null and b/emulation/resources/nds/pokemon white 2_s.png differ diff --git a/emulation/resources/nds/pokemon white_l.png b/emulation/resources/nds/pokemon white_l.png new file mode 100644 index 000000000..7664cbd9d Binary files /dev/null and b/emulation/resources/nds/pokemon white_l.png differ diff --git a/emulation/resources/nds/pokemon white_s.png b/emulation/resources/nds/pokemon white_s.png new file mode 100644 index 000000000..ca16b7fb2 Binary files /dev/null and b/emulation/resources/nds/pokemon white_s.png differ diff --git a/emulation/resources/nes/Castlevania_l.png b/emulation/resources/nes/Castlevania_l.png new file mode 100644 index 000000000..5aae6a634 Binary files /dev/null and b/emulation/resources/nes/Castlevania_l.png differ diff --git a/emulation/resources/nes/Castlevania_s.png b/emulation/resources/nes/Castlevania_s.png new file mode 100644 index 000000000..8b72e1dc5 Binary files /dev/null and b/emulation/resources/nes/Castlevania_s.png differ diff --git a/emulation/resources/nes/castlevania_l.png b/emulation/resources/nes/castlevania_l.png new file mode 100644 index 000000000..5aae6a634 Binary files /dev/null and b/emulation/resources/nes/castlevania_l.png differ diff --git a/emulation/resources/nes/castlevania_s.png b/emulation/resources/nes/castlevania_s.png new file mode 100644 index 000000000..8b72e1dc5 Binary files /dev/null and b/emulation/resources/nes/castlevania_s.png differ diff --git a/emulation/resources/ps/final fantasy vii_big.png b/emulation/resources/ps/final fantasy vii_big.png deleted file mode 100644 index df78418fa..000000000 Binary files a/emulation/resources/ps/final fantasy vii_big.png and /dev/null differ diff --git a/emulation/resources/ps/final fantasy vii_small.png b/emulation/resources/ps/final fantasy vii_small.png deleted file mode 100644 index 57b148ced..000000000 Binary files a/emulation/resources/ps/final fantasy vii_small.png and /dev/null differ diff --git a/emulation/resources/switch/logo.png b/emulation/resources/switch/logo.png new file mode 100644 index 000000000..61d2eccf7 Binary files /dev/null and b/emulation/resources/switch/logo.png differ diff --git a/emulation/resources/wii/logo.png b/emulation/resources/wii/logo.png new file mode 100644 index 000000000..0e9de7571 Binary files /dev/null and b/emulation/resources/wii/logo.png differ diff --git a/frontend/assets/platforms/3ds.png b/frontend/assets/platforms/3ds.png new file mode 100644 index 000000000..d77b71dde Binary files /dev/null and b/frontend/assets/platforms/3ds.png differ diff --git a/frontend/assets/platforms/amiga.png b/frontend/assets/platforms/amiga.png new file mode 100644 index 000000000..8987fcf18 Binary files /dev/null and b/frontend/assets/platforms/amiga.png differ diff --git a/frontend/assets/platforms/arcade.png b/frontend/assets/platforms/arcade.png new file mode 100644 index 000000000..5a9165765 Binary files /dev/null and b/frontend/assets/platforms/arcade.png differ diff --git a/frontend/assets/platforms/atari.png b/frontend/assets/platforms/atari.png new file mode 100644 index 000000000..03c50376f Binary files /dev/null and b/frontend/assets/platforms/atari.png differ diff --git a/frontend/assets/platforms/coleco.png b/frontend/assets/platforms/coleco.png new file mode 100644 index 000000000..04dbc00d0 Binary files /dev/null and b/frontend/assets/platforms/coleco.png differ diff --git a/frontend/assets/platforms/commodore.png b/frontend/assets/platforms/commodore.png new file mode 100644 index 000000000..4f06dc891 Binary files /dev/null and b/frontend/assets/platforms/commodore.png differ diff --git a/frontend/assets/platforms/cpc.png b/frontend/assets/platforms/cpc.png new file mode 100644 index 000000000..f93045f5c Binary files /dev/null and b/frontend/assets/platforms/cpc.png differ diff --git a/frontend/assets/platforms/cps1.png b/frontend/assets/platforms/cps1.png new file mode 100644 index 000000000..814c685cf Binary files /dev/null and b/frontend/assets/platforms/cps1.png differ diff --git a/frontend/assets/platforms/cps2.png b/frontend/assets/platforms/cps2.png new file mode 100644 index 000000000..5256109f1 Binary files /dev/null and b/frontend/assets/platforms/cps2.png differ diff --git a/frontend/assets/platforms/cps3.png b/frontend/assets/platforms/cps3.png new file mode 100644 index 000000000..25bcea947 Binary files /dev/null and b/frontend/assets/platforms/cps3.png differ diff --git a/frontend/assets/platforms/daphne.png b/frontend/assets/platforms/daphne.png new file mode 100644 index 000000000..96c8ce7da Binary files /dev/null and b/frontend/assets/platforms/daphne.png differ diff --git a/frontend/assets/platforms/doom.png b/frontend/assets/platforms/doom.png new file mode 100644 index 000000000..ff9d3165a Binary files /dev/null and b/frontend/assets/platforms/doom.png differ diff --git a/frontend/assets/platforms/dos.png b/frontend/assets/platforms/dos.png new file mode 100644 index 000000000..f873cc138 Binary files /dev/null and b/frontend/assets/platforms/dos.png differ diff --git a/frontend/assets/platforms/fairchild.png b/frontend/assets/platforms/fairchild.png new file mode 100644 index 000000000..29abea634 Binary files /dev/null and b/frontend/assets/platforms/fairchild.png differ diff --git a/frontend/assets/platforms/fba2012.png b/frontend/assets/platforms/fba2012.png new file mode 100644 index 000000000..a0549f366 Binary files /dev/null and b/frontend/assets/platforms/fba2012.png differ diff --git a/frontend/assets/platforms/fbneo.png b/frontend/assets/platforms/fbneo.png new file mode 100644 index 000000000..a0549f366 Binary files /dev/null and b/frontend/assets/platforms/fbneo.png differ diff --git a/frontend/assets/platforms/fds.png b/frontend/assets/platforms/fds.png new file mode 100644 index 000000000..0d4d7e651 Binary files /dev/null and b/frontend/assets/platforms/fds.png differ diff --git a/frontend/assets/platforms/gb.png b/frontend/assets/platforms/gb.png new file mode 100644 index 000000000..efd4134da Binary files /dev/null and b/frontend/assets/platforms/gb.png differ diff --git a/frontend/assets/platforms/gba.png b/frontend/assets/platforms/gba.png new file mode 100644 index 000000000..303fac218 Binary files /dev/null and b/frontend/assets/platforms/gba.png differ diff --git a/frontend/assets/platforms/gbc.png b/frontend/assets/platforms/gbc.png new file mode 100644 index 000000000..d53d7af18 Binary files /dev/null and b/frontend/assets/platforms/gbc.png differ diff --git a/frontend/assets/platforms/genesis-slash-megadrive.png b/frontend/assets/platforms/genesis-slash-megadrive.png new file mode 100644 index 000000000..f159f461d Binary files /dev/null and b/frontend/assets/platforms/genesis-slash-megadrive.png differ diff --git a/frontend/assets/platforms/gg.png b/frontend/assets/platforms/gg.png new file mode 100644 index 000000000..154fb6d3f Binary files /dev/null and b/frontend/assets/platforms/gg.png differ diff --git a/frontend/assets/platforms/gw.png b/frontend/assets/platforms/gw.png new file mode 100644 index 000000000..db4ac8c1b Binary files /dev/null and b/frontend/assets/platforms/gw.png differ diff --git a/frontend/assets/platforms/intellivision.png b/frontend/assets/platforms/intellivision.png new file mode 100644 index 000000000..21f7e77df Binary files /dev/null and b/frontend/assets/platforms/intellivision.png differ diff --git a/frontend/assets/platforms/jaguar.png b/frontend/assets/platforms/jaguar.png new file mode 100644 index 000000000..aabb6e3ef Binary files /dev/null and b/frontend/assets/platforms/jaguar.png differ diff --git a/frontend/assets/platforms/lynx.png b/frontend/assets/platforms/lynx.png new file mode 100644 index 000000000..d9d7fe04b Binary files /dev/null and b/frontend/assets/platforms/lynx.png differ diff --git a/frontend/assets/platforms/md.png b/frontend/assets/platforms/md.png new file mode 100644 index 000000000..344b9d2ad Binary files /dev/null and b/frontend/assets/platforms/md.png differ diff --git a/frontend/assets/platforms/megaduck.png b/frontend/assets/platforms/megaduck.png new file mode 100644 index 000000000..34f94bf22 Binary files /dev/null and b/frontend/assets/platforms/megaduck.png differ diff --git a/frontend/assets/platforms/ms.png b/frontend/assets/platforms/ms.png new file mode 100644 index 000000000..f6861b164 Binary files /dev/null and b/frontend/assets/platforms/ms.png differ diff --git a/frontend/assets/platforms/msx.png b/frontend/assets/platforms/msx.png new file mode 100644 index 000000000..bef3697cd Binary files /dev/null and b/frontend/assets/platforms/msx.png differ diff --git a/frontend/assets/platforms/n64.png b/frontend/assets/platforms/n64.png new file mode 100644 index 000000000..b2292c872 Binary files /dev/null and b/frontend/assets/platforms/n64.png differ diff --git a/frontend/assets/platforms/nds.png b/frontend/assets/platforms/nds.png new file mode 100644 index 000000000..753e0997e Binary files /dev/null and b/frontend/assets/platforms/nds.png differ diff --git a/frontend/assets/platforms/neocd.png b/frontend/assets/platforms/neocd.png new file mode 100644 index 000000000..30c5c8ba8 Binary files /dev/null and b/frontend/assets/platforms/neocd.png differ diff --git a/frontend/assets/platforms/neogeo.png b/frontend/assets/platforms/neogeo.png new file mode 100644 index 000000000..83f3bd7d9 Binary files /dev/null and b/frontend/assets/platforms/neogeo.png differ diff --git a/frontend/assets/platforms/nes.png b/frontend/assets/platforms/nes.png new file mode 100644 index 000000000..81b7772fa Binary files /dev/null and b/frontend/assets/platforms/nes.png differ diff --git a/frontend/assets/platforms/ngp.png b/frontend/assets/platforms/ngp.png new file mode 100644 index 000000000..5bf84f2d1 Binary files /dev/null and b/frontend/assets/platforms/ngp.png differ diff --git a/frontend/assets/platforms/odyssey.png b/frontend/assets/platforms/odyssey.png new file mode 100644 index 000000000..06c2ea2be Binary files /dev/null and b/frontend/assets/platforms/odyssey.png differ diff --git a/frontend/assets/platforms/pce.png b/frontend/assets/platforms/pce.png new file mode 100644 index 000000000..3857a2805 Binary files /dev/null and b/frontend/assets/platforms/pce.png differ diff --git a/frontend/assets/platforms/pcecd.png b/frontend/assets/platforms/pcecd.png new file mode 100644 index 000000000..fae7573c5 Binary files /dev/null and b/frontend/assets/platforms/pcecd.png differ diff --git a/frontend/assets/platforms/pico.png b/frontend/assets/platforms/pico.png new file mode 100644 index 000000000..07217c983 Binary files /dev/null and b/frontend/assets/platforms/pico.png differ diff --git a/frontend/assets/platforms/poke.png b/frontend/assets/platforms/poke.png new file mode 100644 index 000000000..2d905e2c8 Binary files /dev/null and b/frontend/assets/platforms/poke.png differ diff --git a/frontend/assets/platforms/ps.png b/frontend/assets/platforms/ps.png new file mode 100644 index 000000000..f1bc8cec6 Binary files /dev/null and b/frontend/assets/platforms/ps.png differ diff --git a/frontend/assets/platforms/ps2.png b/frontend/assets/platforms/ps2.png new file mode 100644 index 000000000..fab335350 Binary files /dev/null and b/frontend/assets/platforms/ps2.png differ diff --git a/frontend/assets/platforms/psp.png b/frontend/assets/platforms/psp.png new file mode 100644 index 000000000..795d669d5 Binary files /dev/null and b/frontend/assets/platforms/psp.png differ diff --git a/frontend/assets/platforms/scummvm.png b/frontend/assets/platforms/scummvm.png new file mode 100644 index 000000000..d177d04eb Binary files /dev/null and b/frontend/assets/platforms/scummvm.png differ diff --git a/frontend/assets/platforms/segacd.png b/frontend/assets/platforms/segacd.png new file mode 100644 index 000000000..f159f461d Binary files /dev/null and b/frontend/assets/platforms/segacd.png differ diff --git a/frontend/assets/platforms/segasgone.png b/frontend/assets/platforms/segasgone.png new file mode 100644 index 000000000..c2aebae10 Binary files /dev/null and b/frontend/assets/platforms/segasgone.png differ diff --git a/frontend/assets/platforms/sgb.png b/frontend/assets/platforms/sgb.png new file mode 100644 index 000000000..bab09262c Binary files /dev/null and b/frontend/assets/platforms/sgb.png differ diff --git a/frontend/assets/platforms/sgfx.png b/frontend/assets/platforms/sgfx.png new file mode 100644 index 000000000..edf6d590c Binary files /dev/null and b/frontend/assets/platforms/sgfx.png differ diff --git a/frontend/assets/platforms/snes.png b/frontend/assets/platforms/snes.png new file mode 100644 index 000000000..e11237ded Binary files /dev/null and b/frontend/assets/platforms/snes.png differ diff --git a/frontend/assets/platforms/snes_alt.png b/frontend/assets/platforms/snes_alt.png new file mode 100644 index 000000000..b39408e28 Binary files /dev/null and b/frontend/assets/platforms/snes_alt.png differ diff --git a/frontend/assets/platforms/supervision.png b/frontend/assets/platforms/supervision.png new file mode 100644 index 000000000..ef023d899 Binary files /dev/null and b/frontend/assets/platforms/supervision.png differ diff --git a/frontend/assets/platforms/switch.png b/frontend/assets/platforms/switch.png new file mode 100644 index 000000000..23d97c3b9 Binary files /dev/null and b/frontend/assets/platforms/switch.png differ diff --git a/frontend/assets/platforms/tic.png b/frontend/assets/platforms/tic.png new file mode 100644 index 000000000..f70106ca5 Binary files /dev/null and b/frontend/assets/platforms/tic.png differ diff --git a/frontend/assets/platforms/vb.png b/frontend/assets/platforms/vb.png new file mode 100644 index 000000000..641f31cd3 Binary files /dev/null and b/frontend/assets/platforms/vb.png differ diff --git a/frontend/assets/platforms/vectrex.png b/frontend/assets/platforms/vectrex.png new file mode 100644 index 000000000..bf6cb769c Binary files /dev/null and b/frontend/assets/platforms/vectrex.png differ diff --git a/frontend/assets/platforms/videopac.png b/frontend/assets/platforms/videopac.png new file mode 100644 index 000000000..7c9a7871c Binary files /dev/null and b/frontend/assets/platforms/videopac.png differ diff --git a/frontend/assets/platforms/wii.png b/frontend/assets/platforms/wii.png new file mode 100644 index 000000000..cd73e9c6e Binary files /dev/null and b/frontend/assets/platforms/wii.png differ diff --git a/frontend/assets/platforms/ws.png b/frontend/assets/platforms/ws.png new file mode 100644 index 000000000..799a676b1 Binary files /dev/null and b/frontend/assets/platforms/ws.png differ diff --git a/frontend/package.json b/frontend/package.json index fffd98927..7052a9482 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "romm", - "version": "0.13", + "version": "0.19", "private": true, "scripts": { "dev": "vite --host", diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 0058c5376..ad6eb646a 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -1,22 +1,45 @@ - - + + + + + {{ snackbarStatus.msg }} + + + + + - + + @@ -25,21 +48,22 @@ useTheme().global.name.value = localStorage.getItem('theme') || 'dark' /* Firefox */ * { scrollbar-width: none; - scrollbar-color: #808080 #ffffff; + /* scrollbar-width: thin; */ + scrollbar-color: #6e6e6e rgba(0, 0, 0, 0);; } /* Chrome, Edge, and Safari */ *::-webkit-scrollbar { width: 0px; + /* width: 3px; */ } *::-webkit-scrollbar-track { - background: #ffffff; + background: rgba(0, 0, 0, 0); } *::-webkit-scrollbar-thumb { background-color: #808080; - border-radius: 10px; - border: 3px solid #ffffff; + border-radius: 5px; } diff --git a/frontend/src/components/Navigation.vue b/frontend/src/components/Navigation.vue new file mode 100644 index 000000000..3af7e300c --- /dev/null +++ b/frontend/src/components/Navigation.vue @@ -0,0 +1,167 @@ + + + + + + + + Settings + + + + + + + + + Scan + Scanning + + + + + + + + + + + + + + + + + + + ROM MANAGER + + + + + + + + + + + + + + mdi-cog + + + + + + + + {{ rail ? '' : platform.name }} + + + + + + + + + mdi-arrow-collapse-right + mdi-arrow-collapse-left + + + + + + + \ No newline at end of file diff --git a/frontend/src/components/PlatformsBar.vue b/frontend/src/components/PlatformsBar.vue deleted file mode 100644 index 2ce3a6a81..000000000 --- a/frontend/src/components/PlatformsBar.vue +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - - - - - - Rom Manager - - - - - - - - - - - - - - mdi-arrow-collapse-right - mdi-arrow-collapse-left - - - - - - - - - {{ currentPlatformName }} - {{ currentPlatformSlug }} - - - - mdi-cog - - - - - - - Scan - Scanning - - - - - - - - - - - \ No newline at end of file diff --git a/frontend/src/components/RomDetails.vue b/frontend/src/components/RomDetails.vue new file mode 100644 index 000000000..ca0295b58 --- /dev/null +++ b/frontend/src/components/RomDetails.vue @@ -0,0 +1,216 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Search IGDB + + + + Edit + + + + Delete + + + + + + + + + + + + IGDB id: {{ rom.r_igdb_id }} + Name: {{ rom.name }} + File: {{ rom.filename }} + Slug: {{ rom.r_slug }} + Platform: {{ rom.p_slug }} + Cover: {{ rom.path_cover_l }} + + {{ rom.summary }} + + + + + + + + + + + + + + + + + + + {{ rom.name }} + + + + + + + + + + + + + + + + + Apply + + + + + + + + + + + This action can't be reversed. Do you confirm? + + + Confirm + Cancel + + + + + + + + + + \ No newline at end of file diff --git a/frontend/src/components/RomsDetail.vue b/frontend/src/components/RomsDetail.vue deleted file mode 100644 index 14c3e145b..000000000 --- a/frontend/src/components/RomsDetail.vue +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - - - - {{ rom.name }} - - - - - IGDB id: {{ rom.igdb_id }} - Name: {{ rom.name }} - File: {{ rom.filename }} - Slug: {{ rom.slug }} - Platform: {{ rom.platform_slug }} - Cover: {{ rom.path_cover_big }} - - - Download - Download save files - - - - Edit - - - - - - - {{ rom.summary }} - - - \ No newline at end of file diff --git a/frontend/src/components/RomsGallery.vue b/frontend/src/components/RomsGallery.vue index 2d24cea08..922233809 100644 --- a/frontend/src/components/RomsGallery.vue +++ b/frontend/src/components/RomsGallery.vue @@ -1,23 +1,48 @@ - - - - - - - - - - - {{ rom.name }} - - - - - - - - - - + + + + + + + + + + + + + {{ rom.filename }} + + + + + + + + + + - - Feels cold here... mdi-emoticon-sad - + + + + + + + + + + + + + Feels cold here... mdi-emoticon-sad + diff --git a/frontend/src/plugins/vuetify.js b/frontend/src/plugins/vuetify.js index 42fe6ded6..c258c925b 100644 --- a/frontend/src/plugins/vuetify.js +++ b/frontend/src/plugins/vuetify.js @@ -18,9 +18,9 @@ export default createVuetify({ themes: { light: { colors: { - primary: '#1867C0', + primary: '#FFFFFF', secondary: '#BDBDBD', - toolbar: '#BDBDBD' + toolbar: '#FFFFFF' } }, dark: { @@ -28,6 +28,7 @@ export default createVuetify({ primary: '#212121', secondary: '#BDBDBD', toolbar: '#212121', + background: '#212121' } } } diff --git a/frontend/src/router/index.js b/frontend/src/router/index.js index 188d80b28..0f255f8d3 100644 --- a/frontend/src/router/index.js +++ b/frontend/src/router/index.js @@ -8,7 +8,7 @@ const routes = [ }, { path: '/details', - component: () => import('@/components/RomsDetail.vue') + component: () => import('@/components/RomDetails.vue') } ] diff --git a/frontend/src/utils/utils.js b/frontend/src/utils/utils.js new file mode 100644 index 000000000..019174dde --- /dev/null +++ b/frontend/src/utils/utils.js @@ -0,0 +1,14 @@ +import axios from 'axios' +import { saveAs } from 'file-saver' + + +export function downloadRom(rom) { + console.log("Downloading "+rom.filename) + axios.get('/assets/emulation/'+rom.p_slug+'/roms/'+rom.filename, { responseType: 'blob' }).then(response => { + saveAs(new Blob([response.data], { type: 'application/file' }), rom.filename) + }).catch(console.error) +} + +export function downloadSave(rom) { + console.log("Downloading "+rom.filename+" save file") +} \ No newline at end of file
Scan
Scanning
{{ rom.summary }}