From f0cc9562ae93f771893e3e55e2200907d5e2d119 Mon Sep 17 00:00:00 2001 From: Cancerous Date: Fri, 6 Dec 2019 12:20:34 -0500 Subject: [PATCH] further ajustment to buffer size to fix regression --- src/xenia/kernel/xam/xam_info.cc | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/xenia/kernel/xam/xam_info.cc b/src/xenia/kernel/xam/xam_info.cc index 2d8521998..b4bf4bc18 100644 --- a/src/xenia/kernel/xam/xam_info.cc +++ b/src/xenia/kernel/xam/xam_info.cc @@ -361,22 +361,23 @@ dword_result_t XamEnumerate(dword_t handle, dword_t flags, lpvoid_t buffer, } } - // size_t actual_buffer_length = (uint32_t)buffer_length; - // if (buffer_length == e->items_per_enumerate()) { - // // Known culprits: - // // Final Fight: Double Impact (saves) - // XELOGW( - // "Broken usage of XamEnumerate! buffer length=%.X vs actual length=%.X " - // "(item size=%.X, items per enumerate=%u)", - // (uint32_t)buffer_length, actual_buffer_length, e->item_size(), - // e->items_per_enumerate()); - // actual_buffer_length = e->item_size() * e->items_per_enumerate(); - // } + size_t actual_buffer_length = (uint32_t)buffer_length; + if (buffer_length == e->items_per_enumerate()) { + // Known culprits: + // Final Fight: Double Impact (saves) + XELOGW( + "Broken usage of XamEnumerate! buffer length=%.X vs actual length=%.X " + "(item size=%.X, items per enumerate=%u)", + (uint32_t)buffer_length, actual_buffer_length, e->item_size(), + e->items_per_enumerate()); + // actual_buffer_length = e->item_size() * e->items_per_enumerate(); + // leaving old method commented for now until more widely tested + // Don't trust buffer_length. It might be invalid (Based on "Resonance of fate") + // also fixes "Angry Birds" - Thanks Gliniak + actual_buffer_length = e->item_count() * e->item_size(); + } + - // leaving old method commented for now until more widely tested - // Don't trust buffer_length. It might be invalid (Based on "Resonance of fate") - // also fixes "Angry Birds" - Thanks Gliniak - size_t actual_buffer_length = e->item_count() * e->item_size(); buffer.Zero(actual_buffer_length);