[XAM] Error check count in XUserStatsEnumerator
Fix Homefront from crashing
This commit is contained in:
parent
eeb96f91a5
commit
adce6c0919
|
@ -120,6 +120,13 @@ uint32_t XAchievementEnumerator::WriteItems(uint32_t buffer_ptr,
|
||||||
uint32_t XUserStatsEnumerator::WriteItems(uint32_t buffer_ptr,
|
uint32_t XUserStatsEnumerator::WriteItems(uint32_t buffer_ptr,
|
||||||
uint8_t* buffer_data,
|
uint8_t* buffer_data,
|
||||||
uint32_t* written_count) {
|
uint32_t* written_count) {
|
||||||
|
size_t count = std::min(items_.size() - current_item_, items_per_enumerate());
|
||||||
|
if (!count) {
|
||||||
|
return X_ERROR_NO_MORE_FILES;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t size = count * item_size();
|
||||||
|
|
||||||
return X_ERROR_SUCCESS;
|
return X_ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -176,6 +176,12 @@ class XAchievementEnumerator : public XEnumerator {
|
||||||
|
|
||||||
class XUserStatsEnumerator : public XEnumerator {
|
class XUserStatsEnumerator : public XEnumerator {
|
||||||
public:
|
public:
|
||||||
|
struct XUSER_STATS_SPEC {
|
||||||
|
xe::be<uint32_t> ViewId;
|
||||||
|
xe::be<uint32_t> NumColumnIds;
|
||||||
|
xe::be<uint16_t> rgwColumnIds[0x40];
|
||||||
|
};
|
||||||
|
|
||||||
XUserStatsEnumerator(KernelState* kernel_state, size_t items_per_enumerate)
|
XUserStatsEnumerator(KernelState* kernel_state, size_t items_per_enumerate)
|
||||||
: XEnumerator(kernel_state, items_per_enumerate, 0) {}
|
: XEnumerator(kernel_state, items_per_enumerate, 0) {}
|
||||||
|
|
||||||
|
@ -183,6 +189,7 @@ class XUserStatsEnumerator : public XEnumerator {
|
||||||
uint32_t* written_count) override;
|
uint32_t* written_count) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
std::vector<XUSER_STATS_SPEC> items_;
|
||||||
size_t current_item_ = 0;
|
size_t current_item_ = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue