Skip to content

Conversation

@warmenhoven
Copy link
Collaborator

No description provided.

@Jamiras
Copy link
Contributor

Jamiras commented Oct 18, 2025

I haven't reviewed or tested these changes, but the functionality should be moved to https://github.com/libretro/RetroArch/tree/master/libretro-common/streams, so it can be used by stuff other than just achievements (see #13735) - similar to how CHD is handled.

@warmenhoven
Copy link
Collaborator Author

I have been thinking about this a lot, and originally that was my plan:

  • to split cheevos_rvz.c in half,
  • leave the cheevos-specific bits where they are,
  • move the rvz file structure and operations to libretro-common,
  • and change task_database.c to use that as well.

However scanning only requires the disc serial, which is in the rvz header in a fixed location and is not compressed. The scanner currently seeks to that location and reads the serial and doesn't need a deeper understanding of the entire structure of an rvz file. It would be overkill and less efficient to have it use what's been created here.

Really, the only consumer of it in RetroArch is for RetroAchievements, and I don't foresee that it will be useful to any cores. The rvz format is pretty specific to gamecube/Wii.


/* Check for Wii magic word at offset 0x18 */
rcheevos_rvz_seek(rvz, 0x18, SEEK_SET);
if (rcheevos_rvz_read(rvz, magic, 4) == 4)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rcheevos_rvz_read seems like a fairly expensive function call. Suggest reading all 8 bytes in one call.

group_index, (unsigned long long)entry->decompressed_size);
RARCH_LOG("[RVZ_CHUNK] Bytes 0-31: ");
for (i = 0; i < 32; i++)
RARCH_LOG("%02X ", entry->data[i]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This adds a prefix to each output byte:

[INFO] [RVZ_CHUNK]   Bytes 0-31:   [INFO] 47 [INFO] 5A [INFO] 4C [INFO] 50 [INFO] 30 [INFO] 31 [INFO] 00 [INFO] 00 [INFO] 00 [INFO] 00 [INFO] 00 [INFO] 00 [INFO] 00 [INFO] 00 [INFO] 00 [INFO] 00 [INFO] 00 [INFO] 00 [INFO] 00 [INFO] 00 [INFO] 00 [INFO] 00 [INFO] 00 [INFO] 00 [INFO] 00 [INFO] 00 [INFO] 00 [INFO] 00 [INFO] C2 [INFO] 33 [INFO] 9F [INFO] 3D [INFO]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, this logs very verbosely. I assume it's for debuging and will be trimmed or eliminated before merging?

Identifying one GameCube game outputs like ~400 log messages (almsot 5000 for Wii).

Reading one chunk (this gets repeated like 30 times):

[INFO] [RVZ] Group 28: Uncompressed RVZPack (rvz_packed_size=288)
[INFO] [RVZ] RVZPack: Block size=0x00008000 junk=1
[INFO] [RVZ] RVZPack: Junk block - will generate 32768 bytes with LFG (offset=0)
[INFO] [RVZ] RVZPack: Block size=0x00008000 junk=1
[INFO] [RVZ] RVZPack: Junk block - will generate 32768 bytes with LFG (offset=32768)
[INFO] [RVZ] RVZPack: Block size=0x00008000 junk=1
[INFO] [RVZ] RVZPack: Junk block - will generate 32768 bytes with LFG (offset=65536)
[INFO] [RVZ] RVZPack: Block size=0x00008000 junk=1
[INFO] [RVZ] RVZPack: Junk block - will generate 32768 bytes with LFG (offset=98304)
[INFO] [RVZ] RVZPack: Decompressed 288 -> 131072 bytes
[INFO] [RVZ_READ]   Copying 131072 bytes from group 28 offset 0 (chunk_size=131072)


rc_client_begin_identify_and_load_game(rcheevos_locals.client, console_id,
info->path, (const uint8_t*)info->data, info->size, rcheevos_client_load_game_callback, NULL);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, it seems to work for GameCube, but my two Wii test games both generated different hashes than the Dolphin standalone.

Gamecube:

[INFO] [RCHEEVOS] Opened Legend of Zelda, The - The Wind Waker (Europe).rvz
[INFO] [RCHEEVOS] Generated hash 4ac9fb3e05560f402073ff73c49c7276

[INFO] [RCHEEVOS] Opened Mario Kart - Double Dash!! (USA).rvz
[INFO] [RCHEEVOS] Generated hash adad8934d2586d27ec4b653bae52e47b

[INFO] [RCHEEVOS] Opened Metroid Prime (USA) (Rev 2).rvz
[INFO] [RCHEEVOS] Generated hash 92385889dab3531142542a3b7f8502fd

[INFO] [RCHEEVOS] Opened Metroid Prime 2 - Echoes (USA).rvz
[INFO] [RCHEEVOS] Generated hash f7b7c7e8eb92593837ab13d5d62d636e

[INFO] [RCHEEVOS] Opened Paper Mario - The Thousand-Year Door (USA).rvz
[INFO] [RCHEEVOS] Generated hash 495bfe28a1ec59d11d2cc849287549cd

[INFO] [RCHEEVOS] Opened Simpsons, The - Road Rage (USA).rvz
[INFO] [RCHEEVOS] Generated hash 25cd098ca8abb5ee642abb9a9459a575

[INFO] [RCHEEVOS] Opened Super Mario Sunshine (USA).rvz
[INFO] [RCHEEVOS] Generated hash 051e73a951c34842b45641dc4de39f51

[INFO] [RCHEEVOS] Opened Wario World (USA).rvz
[INFO] [RCHEEVOS] Generated hash 2e74fff1b7a94b6576f15f3e67780aaf

Wii:
[INFO] [RCHEEVOS] Opened Bully - Scholarship Edition (USA) (En,Fr,Es).rvz
[INFO] [RCHEEVOS] Generated hash cc00cac3b2298c147d685c967c65ebdd
        dolphin standalone:      eff8921f3062eca576ce97691436c804

[INFO] [RCHEEVOS] Opened Wii Sports Resort (Europe) (En,Fr,De,Es,It) (Rev 1).rvz
[INFO] [RCHEEVOS] Generated hash eb11dc7c0b38ffc83a28b2df4e1ae722
        dolphin standalone:      9561583adf9deb5160b423c981745d06

@warmenhoven
Copy link
Collaborator Author

@Jamiras Thank you, truly, thank you so much, for your reviews. This was the entire reason I posted it so early as a draft, and with all the debug logging still in place (which yes, I will be removing before marking it as "Ready for review").

@LibretroAdmin LibretroAdmin marked this pull request as ready for review October 21, 2025 21:40
@LibretroAdmin LibretroAdmin merged commit fcf0cc7 into libretro:master Oct 21, 2025
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants