Update baseRoms

This commit is contained in:
Jared Schoeny
2025-10-24 01:22:36 -10:00
parent 848a55dbd0
commit b78725b893
5 changed files with 34 additions and 22 deletions

View File

@@ -133,7 +133,7 @@ export default async function HackDetail({ params }: HackDetailProps) {
<div className="card p-5">
<h3 className="text-[15px] font-semibold tracking-tight">Details</h3>
<ul className="mt-3 grid gap-2 text-sm text-foreground/75">
<li>Base ROM: {hack.base_rom}</li>
<li>Base ROM: {baseRom?.name || "Unknown"}</li>
<li>Format: BPS</li>
<li>Created: {new Date(hack.created_at).toLocaleDateString()}</li>
{hack.updated_at && (

View File

@@ -399,7 +399,7 @@ export default function HackSubmitForm({ dummy = false }: HackSubmitFormProps) {
<option value="" disabled>{platform ? "Select base rom" : "Select platform first"}</option>
{baseRoms.filter(r => !platform || r.platform === platform).map(({ id, name, region }) => (
<option key={id} value={id}>
{name.replace('Pokemon ', '')} ({region})
{name.replace('Pokémon ', '')} ({region})
</option>
))}
</select>

View File

@@ -26,6 +26,7 @@ export default function HackCard({ hack, clickable = true, className = "" }: { h
const { isLinked, hasPermission, hasCached } = useBaseRoms();
const match = baseRoms.find((r) => r.id === hack.baseRomId);
const baseId = match?.id ?? undefined;
const baseName = match?.name ?? undefined;
const linked = baseId ? isLinked(baseId) : false;
const ready = baseId ? hasPermission(baseId) || hasCached(baseId) : false;
const images = (hack.covers && hack.covers.length > 0 ? hack.covers : []).filter(Boolean);
@@ -156,7 +157,7 @@ export default function HackCard({ hack, clickable = true, className = "" }: { h
return text.length > 120 ? text.slice(0, 120).trimEnd() + "…" : text;
})()}
</p>
<div className="mt-3 text-xs text-foreground/60">Base: {baseId ?? "Unknown"}</div>
<div className="mt-3 text-xs text-foreground/60">Base: {baseName ?? "Unknown"}</div>
</div>
</div>
);

View File

@@ -105,7 +105,7 @@ export function BaseRomProvider({ children }: { children: React.ReactNode }) {
if (file) {
try {
const hash = await sha1Hex(file);
const match = baseRoms.find((r) => r.sha1 && r.sha1.toLowerCase() === hash.toLowerCase());
const match = baseRoms.find((r) => r.sha1.toLowerCase() === hash.toLowerCase());
if (match) {
await setRomBlob(match.id, file);
setCached((prev) => ({ ...prev, [match.id]: true }));
@@ -242,7 +242,7 @@ export function BaseRomProvider({ children }: { children: React.ReactNode }) {
async function importUploadedBlob(file: File): Promise<string | null> {
try {
const hash = await sha1Hex(file);
const match = baseRoms.find((r) => r.sha1 && r.sha1.toLowerCase() === hash.toLowerCase());
const match = baseRoms.find((r) => r.sha1.toLowerCase() === hash.toLowerCase());
if (!match) return null;
await setRomBlob(match.id, file);
setCached((prev) => ({ ...prev, [match.id]: true }));

View File

@@ -11,31 +11,42 @@ export type BaseRom = {
name: string;
platform: Platform;
region: string;
sha1?: string;
crc32: string;
sha1: string;
};
export const baseRoms: BaseRom[] = [
// GBA
{ id: "poke_emerald", name: "Pokemon Emerald", platform: "GBA", region: "USA, Europe", sha1: "f3ae088181bf583e55daf962a92bb46f4f1d07b7" },
{ id: "poke_firered", name: "Pokemon FireRed (v1.0)", platform: "GBA", region: "USA, Europe", sha1: "41cb23d8dccc8ebd7c649cd8fbb58eeace6e2fdc" },
{ id: "poke_firered_rev1", name: "Pokemon FireRed (Rev 1)", platform: "GBA", region: "USA, Europe", sha1: "dd5945db9b930750cb39d00c84da8571feebf417" },
{ id: "poke_leafgreen", name: "Pokemon LeafGreen", platform: "GBA", region: "USA, Europe" },
{ id: "poke_ruby", name: "Pokemon Ruby", platform: "GBA", region: "USA, Europe" },
{ id: "poke_sapphire", name: "Pokemon Sapphire", platform: "GBA", region: "USA, Europe" },
{ id: "poke_emerald", name: "Pokémon Emerald", platform: "GBA", region: "USA, Europe", crc32: "1f1c08fb", sha1: "f3ae088181bf583e55daf962a92bb46f4f1d07b7" },
{ id: "poke_firered", name: "Pokémon FireRed", platform: "GBA", region: "USA, Europe", crc32: "dd88761c", sha1: "41cb23d8dccc8ebd7c649cd8fbb58eeace6e2fdc" },
{ id: "poke_firered_rev1", name: "Pokémon FireRed (Rev 1)", platform: "GBA", region: "USA, Europe", crc32: "84ee4776", sha1: "dd5945db9b930750cb39d00c84da8571feebf417" },
{ id: "poke_leafgreen", name: "Pokémon LeafGreen", platform: "GBA", region: "USA, Europe", crc32: "d69c96cc", sha1: "574fa542ffebb14be69902d1d36f1ec0a4afd71e" },
{ id: "poke_leafgreen_rev1", name: "Pokémon LeafGreen (Rev 1)", platform: "GBA", region: "USA, Europe", crc32: "daffecec", sha1: "7862c67bdecbe21d1d69ce082ce34327e1c6ed5e" },
{ id: "poke_ruby", name: "Pokémon Ruby", platform: "GBA", region: "USA, Europe", crc32: "f0815ee7", sha1: "f28b6ffc97847e94a6c21a63cacf633ee5c8df1e" },
{ id: "poke_ruby_rev1", name: "Pokémon Ruby (Rev 1)", platform: "GBA", region: "USA, Europe", crc32: "61641576", sha1: "610b96a9c9a7d03d2bafb655e7560ccff1a6d894" },
{ id: "poke_ruby_rev2", name: "Pokémon Ruby (Rev 2)", platform: "GBA", region: "USA, Europe", crc32: "aeac73e6", sha1: "5b64eacf892920518db4ec664e62a086dd5f5bc8" },
{ id: "poke_sapphire", name: "Pokémon Sapphire", platform: "GBA", region: "USA, Europe", crc32: "554dedc4", sha1: "3ccbbd45f8553c36463f13b938e833f652b793e4" },
{ id: "poke_sapphire_rev1", name: "Pokémon Sapphire (Rev 1)", platform: "GBA", region: "USA, Europe", crc32: "bafedae5", sha1: "4722efb8cd45772ca32555b98fd3b9719f8e60a9" },
{ id: "poke_sapphire_rev2", name: "Pokémon Sapphire (Rev 2)", platform: "GBA", region: "USA, Europe", crc32: "9cc4410e", sha1: "89b45fb172e6b55d51fc0e61989775187f6fe63c" },
// GBC
{ id: "poke_crystal", name: "Pokemon Crystal", platform: "GBC", region: "USA, Europe" },
{ id: "poke_gold", name: "Pokémon Gold", platform: "GBC", region: "USA, Europe", crc32: "6bde3c3e", sha1: "d8b8a3600a465308c9953dfa04f0081c05bdcb94" },
{ id: "poke_silver", name: "Pokémon Silver", platform: "GBC", region: "USA, Europe", crc32: "8ad48636", sha1: "49b163f7e57702bc939d642a18f591de55d92dae" },
{ id: "poke_crystal_rev1", name: "Pokémon Crystal (Rev 1)", platform: "GBC", region: "USA, Europe", crc32: "3358e30a", sha1: "f2f52230b536214ef7c9924f483392993e226cfb" },
// GB
{ id: "poke_red", name: "Pokémon Red", platform: "GB", region: "USA, Europe", crc32: "9f7fdd53", sha1: "ea9bcae617fdf159b045185467ae58b2e4a48b9a" },
{ id: "poke_blue", name: "Pokémon Blue", platform: "GB", region: "USA, Europe", crc32: "d6da8a1a", sha1: "d7037c83e1ae5b39bde3c30787637ba1d4c48ce2" },
{ id: "poke_yellow", name: "Pokémon Yellow", platform: "GB", region: "USA, Europe", crc32: "7d527d62", sha1: "cc7d03262ebfaf2f06772c1a480c7d9d5f4a38e1" },
// NDS
{ id: "poke_platinum", name: "Pokemon Platinum", platform: "NDS", region: "USA", sha1: "0862EC35B24DE5C7E2DCB88C9EEA0873110D755C" },
{ id: "poke_heartgold", name: "Pokemon HeartGold", platform: "NDS", region: "USA", sha1: "4FCDED0E2713DC03929845DE631D0932EA2B5A37" },
{ id: "poke_diamond", name: "Pokemon Diamond", platform: "NDS", region: "USA" },
{ id: "poke_pearl", name: "Pokemon Pearl", platform: "NDS", region: "USA" },
{ id: "poke_soulsilver", name: "Pokemon SoulSilver", platform: "NDS", region: "USA" },
{ id: "poke_black_version", name: "Pokemon Black Version", platform: "NDS", region: "USA" },
{ id: "poke_white_version", name: "Pokemon White Version", platform: "NDS", region: "USA" },
{ id: "poke_black_version_2", name: "Pokemon Black Version 2", platform: "NDS", region: "USA" },
{ id: "poke_white_version_2", name: "Pokemon White Version 2", platform: "NDS", region: "USA" },
{ id: "poke_platinum", name: "Pokémon Platinum", platform: "NDS", region: "USA", crc32: "9253921d", sha1: "0862EC35B24DE5C7E2DCB88C9EEA0873110D755C" },
{ id: "poke_heartgold", name: "Pokémon HeartGold", platform: "NDS", region: "USA", crc32: "c180a0e9", sha1: "4FCDED0E2713DC03929845DE631D0932EA2B5A37" },
{ id: "poke_soulsilver", name: "Pokémon SoulSilver", platform: "NDS", region: "USA", crc32: "d8ea6090", sha1: "f8dc38ea20c17541a43b58c5e6d18c1732c7e582" },
{ id: "poke_black", name: "Pokémon Black", platform: "NDS", region: "USA, Europe", crc32: "4f6e5580", sha1: "26ad0b9967aa279c4a266ee69f52b9b2332399a5" },
{ id: "poke_white", name: "Pokémon White", platform: "NDS", region: "USA, Europe", crc32: "b552501c", sha1: "bc696a0dfb448c7b3a8a206f0f8214411a039208" },
{ id: "poke_black_2", name: "Pokémon Black 2", platform: "NDS", region: "USA, Europe", crc32: "d4427fd1", sha1: "e51e6dfb8678a3d19dcd2a10691b96a569ca0abb" },
{ id: "poke_white_2", name: "Pokémon White 2", platform: "NDS", region: "USA, Europe", crc32: "777eb04f", sha1: "b5d7490be7b415b8f1e672a53e978a9cc667e56a" },
];