|
52 | 52 | #include "streams/chd_stream.h" |
53 | 53 | #endif |
54 | 54 |
|
| 55 | +#ifdef HAVE_CHEEVOS_RVZ |
| 56 | +#include "cheevos_rvz.h" |
| 57 | +#endif |
| 58 | + |
55 | 59 | #include "cheevos.h" |
56 | 60 | #include "cheevos_client.h" |
57 | 61 | #include "cheevos_menu.h" |
@@ -1636,8 +1640,33 @@ bool rcheevos_load(const void *data) |
1636 | 1640 | gfx_widget_set_cheevos_set_loading(true); |
1637 | 1641 | #endif |
1638 | 1642 |
|
1639 | | - rc_client_begin_identify_and_load_game(rcheevos_locals.client, RC_CONSOLE_UNKNOWN, |
1640 | | - info->path, (const uint8_t*)info->data, info->size, rcheevos_client_load_game_callback, NULL); |
| 1643 | + /* Detect RVZ files and determine console type (GameCube or Wii) */ |
| 1644 | + { |
| 1645 | + uint32_t console_id = RC_CONSOLE_UNKNOWN; |
| 1646 | + |
| 1647 | +#ifdef HAVE_CHEEVOS_RVZ |
| 1648 | + if (string_is_equal_noncase(path_get_extension(info->path), "rvz")) |
| 1649 | + { |
| 1650 | + console_id = rcheevos_rvz_get_console_id(info->path); |
| 1651 | + |
| 1652 | + /* Only register custom file reader for valid RVZ files */ |
| 1653 | + if (console_id != RC_CONSOLE_UNKNOWN) |
| 1654 | + { |
| 1655 | + struct rc_hash_filereader filereader; |
| 1656 | + |
| 1657 | + filereader.open = rcheevos_rvz_open; |
| 1658 | + filereader.seek = rcheevos_rvz_seek; |
| 1659 | + filereader.tell = rcheevos_rvz_tell; |
| 1660 | + filereader.read = rcheevos_rvz_read; |
| 1661 | + filereader.close = rcheevos_rvz_close; |
| 1662 | + rc_hash_init_custom_filereader(&filereader); |
| 1663 | + } |
| 1664 | + } |
| 1665 | +#endif |
| 1666 | + |
| 1667 | + rc_client_begin_identify_and_load_game(rcheevos_locals.client, console_id, |
| 1668 | + info->path, (const uint8_t*)info->data, info->size, rcheevos_client_load_game_callback, NULL); |
| 1669 | + } |
1641 | 1670 |
|
1642 | 1671 | return true; |
1643 | 1672 | } |
|
0 commit comments