mirror of
https://github.com/TASEmulators/desmume
synced 2025-10-06 00:32:43 +02:00
- fix load/save of cheats;
This commit is contained in:
@@ -557,6 +557,11 @@ BOOL CHEATS::save()
|
|||||||
for (int t = 0; t < list[i].num; t++)
|
for (int t = 0; t < list[i].num; t++)
|
||||||
{
|
{
|
||||||
char buf2[10] = { 0 };
|
char buf2[10] = { 0 };
|
||||||
|
if (list[i].type == 0)
|
||||||
|
{
|
||||||
|
list[i].code[t][0] &= 0x0FFFFFFF;
|
||||||
|
list[i].code[t][0] |= (list[i].size << 28);
|
||||||
|
}
|
||||||
sprintf(buf2, "%08X", list[i].code[t][0]);
|
sprintf(buf2, "%08X", list[i].code[t][0]);
|
||||||
strcat(buf, buf2);
|
strcat(buf, buf2);
|
||||||
sprintf(buf2, "%08X", list[i].code[t][1]);
|
sprintf(buf2, "%08X", list[i].code[t][1]);
|
||||||
@@ -656,6 +661,11 @@ BOOL CHEATS::load()
|
|||||||
|
|
||||||
strncpy(tmp_buf, (char*)(tmp_code + (i*16)), 8);
|
strncpy(tmp_buf, (char*)(tmp_code + (i*16)), 8);
|
||||||
sscanf_s(tmp_buf, "%x", &tmp_cht.code[i][0]);
|
sscanf_s(tmp_buf, "%x", &tmp_cht.code[i][0]);
|
||||||
|
|
||||||
|
if (tmp_cht.type == 0)
|
||||||
|
{
|
||||||
|
tmp_cht.size = std::min<u32>(3, ((tmp_cht.code[i][0] & 0xF0000000) >> 28));
|
||||||
|
}
|
||||||
|
|
||||||
strncpy(tmp_buf, (char*)(tmp_code + (i*16) + 8), 8);
|
strncpy(tmp_buf, (char*)(tmp_code + (i*16) + 8), 8);
|
||||||
sscanf_s(tmp_buf, "%x", &tmp_cht.code[i][1]);
|
sscanf_s(tmp_buf, "%x", &tmp_cht.code[i][1]);
|
||||||
|
@@ -87,6 +87,11 @@ bool save(char *filename)
|
|||||||
for (int t = 0; t < list[i].num; t++)
|
for (int t = 0; t < list[i].num; t++)
|
||||||
{
|
{
|
||||||
char buf2[10] = { 0 };
|
char buf2[10] = { 0 };
|
||||||
|
if (list[i].type == 0)
|
||||||
|
{
|
||||||
|
list[i].hi[t] &= 0x0FFFFFFF;
|
||||||
|
list[i].hi[t] |= (list[i].size << 28);
|
||||||
|
}
|
||||||
sprintf(buf2, "%08X", list[i].hi[t]);
|
sprintf(buf2, "%08X", list[i].hi[t]);
|
||||||
strcat(buf, buf2);
|
strcat(buf, buf2);
|
||||||
sprintf(buf2, "%08X", list[i].lo[t]);
|
sprintf(buf2, "%08X", list[i].lo[t]);
|
||||||
|
Reference in New Issue
Block a user