From c68e72bb949e56d6d6bfa691bda71c38b2560f77 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Tue, 6 Aug 2024 23:23:43 +0100 Subject: [PATCH] Update src/menu/rom_patch_info.c test Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- src/menu/rom_patch_info.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/menu/rom_patch_info.c b/src/menu/rom_patch_info.c index cdb2430f..24940580 100644 --- a/src/menu/rom_patch_info.c +++ b/src/menu/rom_patch_info.c @@ -121,7 +121,21 @@ rom_patch_load_err_t rom_patch_info_load (char *path) // Though needs conversion from JS to C // apply patch dependent on extension. - rom_patch_type_t patch_ext_type = PATCH_TYPE_IPS; // FIXME: should be the extension of the file! + rom_patch_type_t patch_ext_type; + // Determine patch type based on file extension + if (file_has_extension(path, "bps")) { + patch_ext_type = PATCH_TYPE_BPS; + } else if (file_has_extension(path, "ips")) { + patch_ext_type = PATCH_TYPE_IPS; + } else if (file_has_extension(path, "aps")) { + patch_ext_type = PATCH_TYPE_APS; + } else if (file_has_extension(path, "ups")) { + patch_ext_type = PATCH_TYPE_UPS; + } else if (file_has_extension(path, "xdelta")) { + patch_ext_type = PATCH_TYPE_XDELTA; + } else { + return PATCH_ERR_UNSUPPORTED; + } switch (patch_ext_type) {