summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Subv2014-12-21 17:26:51 -0500
committerGravatar Subv2014-12-21 17:26:51 -0500
commitb3cee192892e9ee770c42f203e5a14bca17d4ba0 (patch)
tree3bd0c394f0c0243fcd23d7222d77b61ac9a7b8ca /src
parentCFG: Corrected the licenses in cfg_i.cpp and cfg_u.cpp (diff)
downloadyuzu-b3cee192892e9ee770c42f203e5a14bca17d4ba0.tar.gz
yuzu-b3cee192892e9ee770c42f203e5a14bca17d4ba0.tar.xz
yuzu-b3cee192892e9ee770c42f203e5a14bca17d4ba0.zip
CFG: Changed the CreateConfigInfoBlk search loop
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/cfg/cfg.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/core/hle/service/cfg/cfg.cpp b/src/core/hle/service/cfg/cfg.cpp
index d41e15285..2697f8036 100644
--- a/src/core/hle/service/cfg/cfg.cpp
+++ b/src/core/hle/service/cfg/cfg.cpp
@@ -69,19 +69,16 @@ ResultCode CreateConfigInfoBlk(u32 block_id, u32 size, u32 flags, const u8* data
69 // Insert the block header with offset 0 for now 69 // Insert the block header with offset 0 for now
70 config->block_entries[config->total_entries] = { block_id, 0, size, flags }; 70 config->block_entries[config->total_entries] = { block_id, 0, size, flags };
71 if (size > 4) { 71 if (size > 4) {
72 s32 total_entries = config->total_entries - 1;
73 u32 offset = config->data_entries_offset; 72 u32 offset = config->data_entries_offset;
74 // Perform a search to locate the next offset for the new data 73 // Perform a search to locate the next offset for the new data
75 // use the offset and size of the previous block to determine the new position 74 // use the offset and size of the previous block to determine the new position
76 while (total_entries >= 0) { 75 for (int i = config->total_entries - 1; i >= 0; --i) {
77 // Ignore the blocks that don't have a separate data offset 76 // Ignore the blocks that don't have a separate data offset
78 if (config->block_entries[total_entries].size > 4) { 77 if (config->block_entries[i].size > 4) {
79 offset = config->block_entries[total_entries].offset_or_data + 78 offset = config->block_entries[i].offset_or_data +
80 config->block_entries[total_entries].size; 79 config->block_entries[i].size;
81 break; 80 break;
82 } 81 }
83
84 --total_entries;
85 } 82 }
86 83
87 config->block_entries[config->total_entries].offset_or_data = offset; 84 config->block_entries[config->total_entries].offset_or_data = offset;