Gets the SongKey of the current playing song, based on the initial preview. Last played Song Key
| 69 | /// </summary> |
| 70 | /// <returns>Last played Song Key</returns> |
| 71 | std::string GameState::GetSongKey() { |
| 72 | uintptr_t previewEventPtr = MemUtil::FindDMAAddy(Offsets::baseHandle + Offsets::ptr_previewName, Offsets::ptr_previewNameOffsets); |
| 73 | |
| 74 | if (previewEventPtr) { |
| 75 | const char* previewEvent = (char*)previewEventPtr; |
| 76 | |
| 77 | // Check if it's null terminated within a reasonable number of bytes |
| 78 | if (IsSongKeyStringValid(previewEvent, 50)) |
| 79 | { |
| 80 | auto previewName = std::string(previewEvent); |
| 81 | |
| 82 | // If the preview name contains "Play_", which is required by Wwise. |
| 83 | if (previewName.length() > 13 && previewName._Starts_with("Play_")) { |
| 84 | |
| 85 | // Verify that we are working with a "_Preview" audio. |
| 86 | // "_Invalid" is used when the user turns off their song previews. |
| 87 | if (previewName.compare(previewName.length() - 9, 9, "_Preview") || previewName.compare(previewName.length() - 9, 9, "_Invalid")) { |
| 88 | lastSongKey = previewName.substr(5, previewName.length() - 13); |
| 89 | } |
| 90 | } |
| 91 | } |
| 92 | } |
| 93 | return lastSongKey; |
| 94 | } |
| 95 | |
| 96 | /// <param name="GameNotLoaded"> - Should we trust the pointer?</param> |
| 97 | /// <returns>Internal Menu Name</returns> |
nothing calls this directly
no test coverage detected