- add cheat system (i will Action Replay & Codebreaker parser later :( )
winport:
- add cheats finder and cheats editor;
This commit is contained in:
mtabachenko 2009-01-15 00:46:18 +00:00
parent 0bdad85503
commit 8a9103ed33
16 changed files with 1907 additions and 58 deletions

View File

@ -2768,12 +2768,9 @@ static u8 FASTCALL _MMU_ARM9_read08(u32 adr)
mmu_log_debug_ARM9(adr, "(read08) %0x%X",
MMU.MMU_MEM[ARMCPU_ARM9][(adr>>20)&0xFF][adr&MMU.MMU_MASK[ARMCPU_ARM9][(adr>>20)&0xFF]]);
#endif
if ( (adr >= 0xFFFF0020) && (adr <= 0xFFFF00BC) )
INFO("Read08 at 0x%08X\n", adr);
adr = MMU_LCDmap(adr);
return MMU.MMU_MEM[ARMCPU_ARM9][(adr>>20)&0xFF][adr&MMU.MMU_MASK[ARMCPU_ARM9][(adr>>20)&0xFF]];
return MMU.MMU_MEM[ARMCPU_ARM9][(adr>>20)&0xFF][adr&MMU.MMU_MASK[ARMCPU_ARM9][(adr>>20)&0xFF]];
}
//================================================= MMU ARM9 read 16
@ -2795,8 +2792,6 @@ static u16 FASTCALL _MMU_ARM9_read16(u32 adr)
if ((adr>=0x08800000) && (adr<0x09900000))
return (unsigned short)cflash_read(adr);
#endif
if ( (adr >= 0xFFFF0020) && (adr <= 0xFFFF00BC) )
INFO("Read16 at 0x%08X - 0x%04X\n", adr, T1ReadWord(MMU.MMU_MEM[ARMCPU_ARM9][(adr >> 20) & 0xFF], adr & MMU.MMU_MASK[ARMCPU_ARM9][(adr >> 20) & 0xFF]) );
adr &= 0x0FFFFFFF;
@ -2999,6 +2994,7 @@ static u32 FASTCALL _MMU_ARM9_read32(u32 adr)
}
adr = MMU_LCDmap(adr);
//Returns data from memory
// Removed the &0xFF as they are implicit with the adr&0x0FFFFFFFF [zeromus, inspired by shash]
return T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][(adr >> 20)], adr & MMU.MMU_MASK[ARMCPU_ARM9][(adr >> 20)]);
@ -3854,7 +3850,7 @@ static u32 FASTCALL _MMU_ARM7_read32(u32 adr)
#endif
return T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM7][(adr >> 20)], adr & MMU.MMU_MASK[ARMCPU_ARM7][(adr >> 20)]);
}
//Returns data from memory
// Removed the &0xFF as they are implicit with the adr&0x0FFFFFFFF [zeromus, inspired by shash]
return T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM7][(adr >> 20)], adr & MMU.MMU_MASK[ARMCPU_ARM7][(adr >> 20)]);
@ -3865,6 +3861,7 @@ static u32 FASTCALL _MMU_ARM7_read32(u32 adr)
u32 FASTCALL MMU_read32(u32 proc, u32 adr)
{
ASSERT_UNALIGNED((adr&3)==0);
if(proc==0)
return _MMU_ARM9_read32(adr);
else
@ -3874,6 +3871,7 @@ u32 FASTCALL MMU_read32(u32 proc, u32 adr)
u16 FASTCALL MMU_read16(u32 proc, u32 adr)
{
ASSERT_UNALIGNED((adr&1)==0);
if(proc==0)
return _MMU_ARM9_read16(adr);
else

View File

@ -35,6 +35,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "utils/decrypt/decrypt.h"
#include "bios.h"
#include "debug.h"
#include "cheatSystem.h"
#ifdef _WIN32
#include "./windows/disView.h"
@ -44,6 +45,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
static BOOL LidClosed = FALSE;
static u8 LidKeyCount = 0;
static u8 pathToROMwithoutExt[MAX_PATH];
/* the count of bytes copied from the firmware into memory */
#define NDS_FW_USER_SETTINGS_MEM_BYTE_COUNT 0x70
@ -424,6 +426,14 @@ int NDS_LoadROM( const char *filename, int bmtype, u32 bmsize,
strncpy(szRomPath, filename, t+1);
break;
}
for (int t = strlen(filename); t>0; t--)
if ( (filename[t] == '\\') || (filename[t] == '/') || (filename[t] == '.') )
{
if (filename[t] != '.') return -1;
strncpy((char *)pathToROMwithoutExt, filename, t+1);
break;
}
MMU_unsetRom();
NDS_SetROM(data, mask);
@ -441,6 +451,8 @@ int NDS_LoadROM( const char *filename, int bmtype, u32 bmsize,
else
szRomBaseName[strlen(szRomBaseName)-4] = 0x00;
cheatsInit((char *)pathToROMwithoutExt);
// Setup Backup Memory
if(type == ROM_DSGBA)
{
@ -625,6 +637,7 @@ void NDS_Reset( void)
gfx3d_reset();
gpu3D->NDS_3D_Reset();
SPU_Reset();
cheatsSearchClose();
}
int NDS_ImportSave(const char *filename)
@ -1163,6 +1176,8 @@ u32 NDS_exec(s32 nb)
T1WriteWord(MMU.ARM7_REG, 4, T1ReadWord(MMU.ARM7_REG, 4) | 1);
NDS_ARM9VBlankInt();
NDS_ARM7VBlankInt();
cheatsProcess();
nds.runCycleCollector[nds.idleFrameCounter] = 1120380-nds.idleCycles;
nds.idleFrameCounter++;
nds.idleFrameCounter &= 15;

View File

@ -33,6 +33,7 @@
extern volatile BOOL execute;
extern BOOL click;
extern u8 pathToROMwithoutExt[MAX_PATH];
/*
* The firmware language values

561
desmume/src/cheatSystem.cpp Normal file
View File

@ -0,0 +1,561 @@
/* Copyright (C) 2006 yopyop
yopyop156@ifrance.com
yopyop156.ifrance.com
Copyright 2009 CrazyMax
Copyright 2009 DeSmuME team
This file is part of DeSmuME
DeSmuME is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "cheatSystem.h"
#include "mem.h"
#include "MMU.h"
#include "debug.h"
static CHEATS_LIST cheats[MAX_CHEAT_LIST];
static u16 cheatsNum = 0;
static u8 cheatFilename[MAX_PATH];
static u32 cheatsCurrentGet = 0;
static u8 *cheatsStack = NULL;
static u16 cheatsNumStack = 0;
void cheatsInit(char *path)
{
memset(cheats, 0, sizeof(cheats));
for (int i = 0; i < MAX_CHEAT_LIST; i++)
cheats[i].type = 0xFF;
cheatsNum = 0;
cheatsCurrentGet = 0;
strcpy((char *)cheatFilename, path);
strcat((char *)cheatFilename, "cht");
if (cheatsStack) delete [] cheatsStack;
cheatsStack = NULL;
cheatsLoad();
}
BOOL cheatsAdd(u8 proc, u8 size, u32 address, u32 val, char *description, BOOL enabled)
{
if (cheatsNum == MAX_CHEAT_LIST) return FALSE;
cheats[cheatsNum].proc = proc;
cheats[cheatsNum].hi[0] = address & 0x00FFFFFF;
cheats[cheatsNum].lo[0] = val;
cheats[cheatsNum].num = 1;
cheats[cheatsNum].type = 0;
cheats[cheatsNum].size = size;
strcpy(cheats[cheatsNum].description, description);
cheats[cheatsNum].enabled = enabled;
cheatsNum++;
return TRUE;
}
BOOL cheatsAdd_AR(char *code, char *description, BOOL enabled)
{
return FALSE;
}
BOOL cheatsAdd_CB(char *code, char *description, BOOL enabled)
{
return FALSE;
}
BOOL cheatsRemove(u32 pos)
{
if (pos > cheatsNum) return FALSE;
for (int i = pos; i < cheatsNum; i++)
memcpy(&cheats[i], &cheats[i+1], sizeof(CHEATS_LIST));
if (cheatsNum == 0) return FALSE;
cheatsNum--;
return TRUE;
}
void cheatsGetListReset()
{
cheatsCurrentGet = 0;
return;
}
BOOL cheatsGetList(CHEATS_LIST *cheat)
{
if (cheatsCurrentGet > cheatsNum)
{
cheatsCurrentGet = 0;
return FALSE;
}
memcpy(cheat, &cheats[cheatsCurrentGet++], sizeof(CHEATS_LIST));
if (cheatsCurrentGet > cheatsNum)
{
cheatsCurrentGet = 0;
return FALSE;
}
return TRUE;
}
BOOL cheatsSave()
{
#ifdef WIN32
char buf[20];
FILE *file = fopen((char *)cheatFilename, "w");
fclose(file);
WritePrivateProfileString("General", "Name", "<game name>", (char *)cheatFilename);
WritePrivateProfileInt("General", "NumberOfCheats", cheatsNum, (char *)cheatFilename);
for (int i = 0; i < cheatsNum; i++)
{
wsprintf(buf, "Desc%04i", i);
WritePrivateProfileString("Cheats", buf, cheats[i].description, (char *)cheatFilename);
wsprintf(buf, "Type%04i", i);
WritePrivateProfileInt("Cheats", buf, cheats[i].type, (char *)cheatFilename);
wsprintf(buf, "Num_%04i", i);
WritePrivateProfileInt("Cheats", buf, cheats[i].num, (char *)cheatFilename);
wsprintf(buf, "Enab%04i", i);
WritePrivateProfileInt("Cheats", buf, cheats[i].enabled, (char *)cheatFilename);
wsprintf(buf, "Proc%04i", i);
WritePrivateProfileInt("Cheats", buf, cheats[i].proc, (char *)cheatFilename);
wsprintf(buf, "Size%04i", i);
WritePrivateProfileInt("Cheats", buf, cheats[i].size, (char *)cheatFilename);
for (int t = 0; t < cheats[i].num; t++)
{
char tmp_hex[6] = {0};
wsprintf(tmp_hex, "%06X", cheats[i].hi[t]);
wsprintf(buf, "H%03i%04i", i, t);
WritePrivateProfileString("Cheats", buf, tmp_hex, (char *)cheatFilename);
wsprintf(buf, "L%03i%04i", i, t);
WritePrivateProfileInt("Cheats", buf, cheats[i].lo[t], (char *)cheatFilename);
}
}
#endif
return TRUE;
}
BOOL cheatsLoad()
{
#ifdef WIN32
char buf[20];
cheatsNum = GetPrivateProfileInt("General", "NumberOfCheats", 0, (char *)cheatFilename);
if (cheatsNum > MAX_CHEAT_LIST) cheatsNum = MAX_CHEAT_LIST;
for (int i = 0; i < cheatsNum; i++)
{
wsprintf(buf, "Desc%04i", i);
GetPrivateProfileString("Cheats", buf, "", cheats[i].description, 75, (char *)cheatFilename);
wsprintf(buf, "Type%04i", i);
cheats[i].type = GetPrivateProfileInt("Cheats", buf, 0xFF, (char *)cheatFilename);
wsprintf(buf, "Num_%04i", i);
cheats[i].num = GetPrivateProfileInt("Cheats", buf, 0, (char *)cheatFilename);
wsprintf(buf, "Enab%04i", i);
cheats[i].enabled = GetPrivateProfileInt("Cheats", buf, 0, (char *)cheatFilename);
wsprintf(buf, "Proc%04i", i);
cheats[i].proc = GetPrivateProfileInt("Cheats", buf, 0, (char *)cheatFilename);
wsprintf(buf, "Size%04i", i);
cheats[i].size = GetPrivateProfileInt("Cheats", buf, 0, (char *)cheatFilename);
for (int t = 0; t < cheats[i].num; t++)
{
char tmp_buf[10] = { 0 };
wsprintf(buf, "H%03i%04i", i, t);
GetPrivateProfileString("Cheats", buf, "0", tmp_buf, 10, (char *)cheatFilename);
sscanf_s(tmp_buf, "%x", &cheats[i].hi[t]);
wsprintf(buf, "L%03i%04i", i, t);
cheats[i].lo[t] = GetPrivateProfileInt("Cheats", buf, 0, (char *)cheatFilename);
}
}
#endif
return TRUE;
}
BOOL cheatsPush()
{
if (cheatsStack) return FALSE;
cheatsStack = new u8 [sizeof(cheats)];
memcpy(cheatsStack, cheats, sizeof(cheats));
cheatsNumStack = cheatsNum;
return TRUE;
}
BOOL cheatsPop()
{
if (!cheatsStack) return FALSE;
memcpy(cheats, cheatsStack, sizeof(cheats));
cheatsNum = cheatsNumStack;
delete [] cheatsStack;
cheatsStack = NULL;
return TRUE;
}
void cheatsStackClear()
{
if (!cheatsStack) return;
delete [] cheatsStack;
cheatsStack = NULL;
}
void cheatsProcess()
{
if (!cheatsNum) return;
for (int i = 0; i < cheatsNum; i++)
{
if (!cheats[i].enabled) continue;
switch (cheats[i].type)
{
case 0: // internal cheat system
//INFO("cheat at 0x02|%06X value %i (size %i)\n",cheats[i].hi[0], cheats[i].lo[0], cheats[i].size);
switch (cheats[i].size)
{
case 0: T1WriteByte(MMU.MMU_MEM[cheats[i].proc][0x20], cheats[i].hi[0], cheats[i].lo[0]); break;
case 1: T1WriteWord(MMU.MMU_MEM[cheats[i].proc][0x20], cheats[i].hi[0], cheats[i].lo[0]); break;
case 2:
{
u32 tmp = T1ReadLong(MMU.MMU_MEM[cheats[i].proc][0x20], cheats[i].hi[0]);
tmp &= 0xFF000000;
tmp |= (cheats[i].lo[0] & 0x00FFFFFF);
T1WriteLong(MMU.MMU_MEM[cheats[i].proc][0x20], cheats[i].hi[0], tmp);
break;
}
case 3: T1WriteLong(MMU.MMU_MEM[cheats[i].proc][0x20], cheats[i].hi[0], cheats[i].lo[0]); break;
}
break;
case 1: // Action Replay
break;
case 2: // Codebreaker
break;
default: continue;
}
}
}
// ========================================== search
u8 *searchStatMemARM9 = NULL;
u8 *searchStatMemARM7 = NULL;
u8 *searchMemARM9 = NULL;
u8 *searchMemARM7 = NULL;
u32 searchNumber = 0;
u32 searchLastRecord = 0;
u32 searchLastRecordProc = 0;
u32 searchType = 0;
u32 searchSize = 0;
u32 searchSign = 0;
void cheatsSearchInit(u8 type, u8 size, u8 sign)
{
if (searchStatMemARM9) return;
if (searchStatMemARM7) return;
if (searchMemARM9) return;
if (searchMemARM7) return;
searchStatMemARM9 = new u8 [ ( 4 * 1024 * 1024 ) / 8 ];
searchStatMemARM7 = new u8 [ ( 4 * 1024 * 1024 ) / 8 ];
memset(searchStatMemARM9, 0xFF, ( 4 * 1024 * 1024 ) / 8);
memset(searchStatMemARM7, 0xFF, ( 4 * 1024 * 1024 ) / 8);
if (type == 1) // comparative search type (need 8Mb RAM !!! (4+4))
{
searchMemARM9 = new u8 [ ( 4 * 1024 * 1024 ) ];
searchMemARM7 = new u8 [ ( 4 * 1024 * 1024 ) ];
memcpy(searchMemARM9, MMU.MMU_MEM[0][0x20], ( 4 * 1024 * 1024 ) );
memcpy(searchMemARM7, MMU.MMU_MEM[1][0x20], ( 4 * 1024 * 1024 ) );
}
searchType = type;
searchSize = size;
searchSign = sign;
searchNumber = 0;
searchLastRecord = 0;
searchLastRecordProc = 0;
//INFO("Cheat search system is inited (type %s)\n", type?"comparative":"exact");
}
void cheatsSearchClose()
{
if (searchStatMemARM9) delete [] searchStatMemARM9;
if (searchStatMemARM7) delete [] searchStatMemARM7;
searchStatMemARM9 = NULL;
searchStatMemARM7 = NULL;
if (searchMemARM9) delete [] searchMemARM9;
if (searchMemARM7) delete [] searchMemARM7;
searchMemARM9 = NULL;
searchMemARM7 = NULL;
searchNumber = 0;
searchLastRecord = 0;
searchLastRecordProc = 0;
//INFO("Cheat search system is closed\n");
}
u32 cheatsSearchValue(u32 val)
{
u8 *stat[2] = {searchStatMemARM9, searchStatMemARM7};
searchNumber = 0;
switch (searchSize)
{
case 0: // 1 byte
for (u32 t = 0; t < 2; t++)
for (u32 i = 0; i < (4 * 1024 * 1024); i++)
{
u32 addr = (i >> 3);
u32 offs = (i % 8);
if (stat[t][addr] & (1<<offs))
{
if ( T1ReadByte(MMU.MMU_MEM[t][0x20], i) == val )
{
stat[t][addr] |= (1<<offs);
searchNumber++;
continue;
}
stat[t][addr] &= ~(1<<offs);
}
}
break;
case 1: // 2 bytes
for (u32 t = 0; t < 2; t++)
for (u32 i = 0; i < (4 * 1024 * 1024); i+=2)
{
u32 addr = (i >> 3);
u32 offs = (i % 8);
if (stat[t][addr] & (3<<offs))
{
if ( T1ReadWord(MMU.MMU_MEM[t][0x20], i) == val )
{
stat[t][addr] |= (3<<offs);
searchNumber++;
continue;
}
stat[t][addr] &= ~(3<<offs);
}
}
break;
case 2: // 3 bytes
for (u32 t = 0; t < 2; t++)
for (u32 i = 0; i < (4 * 1024 * 1024); i+=3)
{
u32 addr = (i >> 3);
u32 offs = (i % 8);
if (stat[t][addr] & (0x7<<offs))
{
if ( (T1ReadLong(MMU.MMU_MEM[t][0x20], i) & 0x00FFFFFF) == val )
{
stat[t][addr] |= (0x7<<offs);
searchNumber++;
continue;
}
stat[t][addr] &= ~(0x7<<offs);
}
}
break;
case 3: // 4 bytes
for (u32 t = 0; t < 2; t++)
for (u32 i = 0; i < (4 * 1024 * 1024); i+=4)
{
u32 addr = (i >> 3);
u32 offs = (i % 8);
if (stat[t][addr] & (0xF<<offs))
{
if ( T1ReadLong(MMU.MMU_MEM[t][0x20], i) == val )
{
stat[t][addr] |= (0xF<<offs);
searchNumber++;
continue;
}
stat[t][addr] &= ~(0xF<<offs);
}
}
break;
}
return (searchNumber);
}
u32 cheatsSearchComp(u8 comp)
{
u8 *mem[2] = {searchMemARM9, searchMemARM7};
u8 *stat[2] = {searchStatMemARM9, searchStatMemARM7};
BOOL res = FALSE;
searchNumber = 0;
switch (searchSize)
{
case 0: // 1 byte
for (u32 t = 0; t < 2; t++)
for (u32 i = 0; i < (4 * 1024 * 1024); i++)
{
u32 addr = (i >> 3);
u32 offs = (i % 8);
if (stat[t][addr] & (1<<offs))
{
switch (comp)
{
case 0: res=(T1ReadByte(MMU.MMU_MEM[t][0x20], i) > T1ReadByte(mem[t], i)); break;
case 1: res=(T1ReadByte(MMU.MMU_MEM[t][0x20], i) < T1ReadByte(mem[t], i)); break;
case 2: res=(T1ReadByte(MMU.MMU_MEM[t][0x20], i) == T1ReadByte(mem[t], i)); break;
case 3: res=(T1ReadByte(MMU.MMU_MEM[t][0x20], i) != T1ReadByte(mem[t], i)); break;
default: res = FALSE; break;
}
if ( res )
{
stat[t][addr] |= (1<<offs);
searchNumber++;
continue;
}
stat[t][addr] &= ~(1<<offs);
}
}
break;
case 1: // 2 bytes
for (u32 t = 0; t < 2; t++)
for (u32 i = 0; i < (4 * 1024 * 1024); i+=2)
{
u32 addr = (i >> 3);
u32 offs = (i % 8);
if (stat[t][addr] & (3<<offs))
{
switch (comp)
{
case 0: res=(T1ReadWord(MMU.MMU_MEM[t][0x20], i) > T1ReadWord(mem[t], i)); break;
case 1: res=(T1ReadWord(MMU.MMU_MEM[t][0x20], i) < T1ReadWord(mem[t], i)); break;
case 2: res=(T1ReadWord(MMU.MMU_MEM[t][0x20], i) == T1ReadWord(mem[t], i)); break;
case 3: res=(T1ReadWord(MMU.MMU_MEM[t][0x20], i) != T1ReadWord(mem[t], i)); break;
default: res = FALSE; break;
}
if ( res )
{
stat[t][addr] |= (3<<offs);
searchNumber++;
continue;
}
stat[t][addr] &= ~(3<<offs);
}
}
break;
case 2: // 3 bytes
for (u32 t = 0; t < 2; t++)
for (u32 i = 0; i < (4 * 1024 * 1024); i+=3)
{
u32 addr = (i >> 3);
u32 offs = (i % 8);
if (stat[t][addr] & (7<<offs))
{
switch (comp)
{
case 0: res=((T1ReadLong(MMU.MMU_MEM[t][0x20], i) & 0x00FFFFFF) > (T1ReadLong(mem[t], i) & 0x00FFFFFF) ); break;
case 1: res=((T1ReadLong(MMU.MMU_MEM[t][0x20], i) & 0x00FFFFFF) < (T1ReadLong(mem[t], i) & 0x00FFFFFF) ); break;
case 2: res=((T1ReadLong(MMU.MMU_MEM[t][0x20], i) & 0x00FFFFFF) == (T1ReadLong(mem[t], i) & 0x00FFFFFF) ); break;
case 3: res=((T1ReadLong(MMU.MMU_MEM[t][0x20], i) & 0x00FFFFFF) != (T1ReadLong(mem[t], i) & 0x00FFFFFF) ); break;
default: res = FALSE; break;
}
if ( res )
{
stat[t][addr] |= (7<<offs);
searchNumber++;
continue;
}
stat[t][addr] &= ~(7<<offs);
}
}
break;
case 3: // 4 bytes
for (u32 t = 0; t < 2; t++)
for (u32 i = 0; i < (4 * 1024 * 1024); i+=4)
{
u32 addr = (i >> 3);
u32 offs = (i % 8);
if (stat[t][addr] & (0xF<<offs))
{
switch (comp)
{
case 0: res=(T1ReadLong(MMU.MMU_MEM[t][0x20], i) > T1ReadLong(mem[t], i)); break;
case 1: res=(T1ReadLong(MMU.MMU_MEM[t][0x20], i) < T1ReadLong(mem[t], i)); break;
case 2: res=(T1ReadLong(MMU.MMU_MEM[t][0x20], i) == T1ReadLong(mem[t], i)); break;
case 3: res=(T1ReadLong(MMU.MMU_MEM[t][0x20], i) != T1ReadLong(mem[t], i)); break;
default: res = FALSE; break;
}
if ( res )
{
stat[t][addr] |= (0xF<<offs);
searchNumber++;
continue;
}
stat[t][addr] &= ~(0xF<<offs);
}
}
break;
}
memcpy(searchMemARM9, MMU.MMU_MEM[0][0x20], ( 4 * 1024 * 1024 ) );
memcpy(searchMemARM7, MMU.MMU_MEM[1][0x20], ( 4 * 1024 * 1024 ) );
return (searchNumber);
}
u32 cheatSearchNumber()
{
return (searchNumber);
}
BOOL cheatSearchGetList(u8 *proc, u32 *address, u32 *curVal)
{
u8 *stat[2] = {searchStatMemARM9, searchStatMemARM7};
for (u32 t = searchLastRecordProc; t < 2; t++)
{
for (u32 i = searchLastRecord; i < (4 * 1024 * 1024); i++)
{
u32 addr = (i >> 3);
u32 offs = (i % 8);
if (stat[t][addr] & (1<<offs))
{
*proc = t;
*address = i;
searchLastRecord = i+1;
switch (searchSize)
{
case 0: *curVal=(u32)T1ReadByte(MMU.MMU_MEM[t][0x20], i); return TRUE;
case 1: *curVal=(u32)T1ReadWord(MMU.MMU_MEM[t][0x20], i); return TRUE;
case 2: *curVal=(u32)T1ReadLong(MMU.MMU_MEM[t][0x20], i) & 0x00FFFFFF; return TRUE;
case 3: *curVal=(u32)T1ReadLong(MMU.MMU_MEM[t][0x20], i); return TRUE;
default: return TRUE;
}
}
}
searchLastRecordProc = t;
}
searchLastRecord = 0;
searchLastRecordProc = 0;
return FALSE;
}
void cheatSearchGetListReset()
{
searchLastRecord = 0;
searchLastRecordProc = 0;
}

65
desmume/src/cheatSystem.h Normal file
View File

@ -0,0 +1,65 @@
/* Copyright (C) 2006 yopyop
yopyop156@ifrance.com
yopyop156.ifrance.com
Copyright 2009 CrazyMax
Copyright 2009 DeSmuME team
This file is part of DeSmuME
DeSmuME is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "common.h"
#define MAX_CHEAT_LIST 100
typedef struct
{
u8 type; // 0 - internal cheat system
// 1 - Action Replay
// 2 - Codebreakers
BOOL enabled;
u8 proc;
u32 hi[255];
u32 lo[255];
char description[75];
u8 num;
u8 size;
} CHEATS_LIST;
extern void cheatsInit(char *path);
extern BOOL cheatsAdd(u8 proc, u8 size, u32 address, u32 val, char *description, BOOL enabled);
extern BOOL cheatsAdd_AR(char *code, char *description, BOOL enabled);
extern BOOL cheatsAdd_CB(char *code, char *description, BOOL enabled);
extern BOOL cheatsRemove(u32 pos);
extern void cheatsGetListReset();
extern BOOL cheatsGetList(CHEATS_LIST *cheat);
extern BOOL cheatsSave();
extern BOOL cheatsLoad();
extern BOOL cheatsPush();
extern BOOL cheatsPop();
extern void cheatsStackClear();
extern void cheatsProcess();
// ==================================================== cheat search
extern void cheatsSearchInit(u8 type, u8 size, u8 sign);
extern void cheatsSearchClose();
extern u32 cheatsSearchValue(u32 val);
extern u32 cheatsSearchComp(u8 comp);
extern u32 cheatSearchNumber();
extern BOOL cheatSearchGetList(u8 *proc, u32 *address, u32 *curVal);
extern void cheatSearchGetListReset();

View File

@ -466,6 +466,14 @@
RelativePath=".\aviout.cpp"
>
</File>
<File
RelativePath=".\cheatsWin.cpp"
>
</File>
<File
RelativePath=".\cheatsWin.h"
>
</File>
<File
RelativePath=".\colorctrl.cpp"
>
@ -884,6 +892,14 @@
RelativePath="..\cflash.h"
>
</File>
<File
RelativePath="..\cheatSystem.cpp"
>
</File>
<File
RelativePath="..\cheatSystem.h"
>
</File>
<File
RelativePath="..\common.cpp"
>

View File

@ -492,6 +492,10 @@
RelativePath="..\cflash.cpp"
>
</File>
<File
RelativePath="..\cheatSystem.cpp"
>
</File>
<File
RelativePath="..\common.cpp"
>
@ -866,6 +870,10 @@
RelativePath=".\aviout.cpp"
>
</File>
<File
RelativePath=".\cheatsWin.cpp"
>
</File>
<File
RelativePath=".\colorctrl.cpp"
>
@ -980,6 +988,10 @@
RelativePath=".\AboutBox.h"
>
</File>
<File
RelativePath=".\cheatsWin.h"
>
</File>
<File
RelativePath=".\colorctrl.h"
>
@ -1088,6 +1100,10 @@
RelativePath="..\cflash.h"
>
</File>
<File
RelativePath="..\cheatSystem.h"
>
</File>
<File
RelativePath="..\common.h"
>

View File

@ -5,7 +5,7 @@
Name="DeSmuME_Intel"
ProjectGUID="{3DA70B4E-4FE0-428C-9084-F6CE33810F6B}"
VCNestedProjectGUID="{9F5F72A1-D3A5-4918-B460-E076B16D10A9}"
VCNestedProjectCRC32="1264686066"
VCNestedProjectCRC32="2631812102"
VCNestedProjectFileName="DeSmuME_Intel.vcproj">
<Platforms>
<Platform
@ -333,6 +333,8 @@
RelativePath="..\bits.h"/>
<File
RelativePath="..\cflash.h"/>
<File
RelativePath="..\cheatSystem.h"/>
<File
RelativePath="..\common.h"/>
<File
@ -401,6 +403,8 @@
RelativePath="..\wifi.h"/>
<File
RelativePath=".\AboutBox.h"/>
<File
RelativePath=".\cheatsWin.h"/>
<File
RelativePath=".\colorctrl.h"/>
<File
@ -577,6 +581,8 @@
RelativePath="..\bios.cpp"/>
<File
RelativePath="..\cflash.cpp"/>
<File
RelativePath="..\cheatSystem.cpp"/>
<File
RelativePath="..\common.cpp"/>
<File
@ -627,6 +633,8 @@
RelativePath=".\AboutBox.cpp"/>
<File
RelativePath=".\aviout.cpp"/>
<File
RelativePath=".\cheatsWin.cpp"/>
<File
RelativePath=".\colorctrl.cpp"/>
<File

View File

@ -492,6 +492,10 @@
RelativePath="..\cflash.cpp"
>
</File>
<File
RelativePath="..\cheatSystem.cpp"
>
</File>
<File
RelativePath="..\common.cpp"
>
@ -866,6 +870,10 @@
RelativePath=".\aviout.cpp"
>
</File>
<File
RelativePath=".\cheatsWin.cpp"
>
</File>
<File
RelativePath=".\colorctrl.cpp"
>
@ -980,6 +988,10 @@
RelativePath=".\AboutBox.h"
>
</File>
<File
RelativePath=".\cheatsWin.h"
>
</File>
<File
RelativePath=".\colorctrl.h"
>
@ -1088,6 +1100,10 @@
RelativePath="..\cflash.h"
>
</File>
<File
RelativePath="..\cheatSystem.h"
>
</File>
<File
RelativePath="..\common.h"
>

View File

@ -0,0 +1,818 @@
/* Copyright (C) 2006 yopyop
yopyop156@ifrance.com
yopyop156.ifrance.com
Copyright 2009 CrazyMax
Copyright 2009 DeSmuME team
This file is part of DeSmuME
DeSmuME is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "cheatsWin.h"
#include <commctrl.h>
#include "../cheatSystem.h"
#include "resource.h"
#include "../debug.h"
static u8 searchType = 0;
static u8 searchSize = 0;
static u8 searchSign = 0;
static u8 searchStep = 0;
static u8 searchComp = 0;
static HWND hBRestart = NULL;
static HWND hBView = NULL;
static HWND hBSearch = NULL;
static u32 exactVal = 0;
static u32 searchNumberResults = 0;
u8 searchAddProc = 0;
u32 searchAddAddress = 0;
u32 searchAddValue = 0;
u8 searchAddMode = 0;
u8 searchAddFreeze = 1;
u8 searchAddSize = 0;
static char editBuf[4][75] = { 0 };
HWND searchWnd = NULL;
HWND searchListView = NULL;
HWND cheatListView = NULL;
WNDPROC oldEditProc = NULL;
WNDPROC oldEditProcHEX = NULL;
CHEATS_LIST tempCheat;
static char *NAME_CPUs[2] = { "ARM9", "ARM7" };
u32 searchIDDs[2][4] = {
{ IDD_CHEAT_SEARCH_MAIN, IDD_CHEAT_SEARCH_EXACT, IDD_CHEAT_SEARCH_RESULT, NULL },
{ IDD_CHEAT_SEARCH_MAIN, IDD_CHEAT_SEARCH_RESULT, IDD_CHEAT_SEARCH_COMP, IDD_CHEAT_SEARCH_RESULT}
};
u32 searchSizeIDDs[4] = { IDC_RADIO1, IDC_RADIO2, IDC_RADIO3, IDC_RADIO4 };
u32 searchSignIDDs[2] = { IDC_RADIO5, IDC_RADIO6 };
u32 searchTypeIDDs[2] = { IDC_RADIO7, IDC_RADIO8 };
u32 searchCompIDDs[4] = { IDC_RADIO1, IDC_RADIO2, IDC_RADIO3, IDC_RADIO4 };
u32 searchRangeIDDs[4] = { IDC_STATIC_S1, IDC_STATIC_S2, IDC_STATIC_S3, IDC_STATIC_S4 };
char *searchRangeText[2][4] = { {"[0..255]", "[0..65536]", "[0..16777215]", "[0..4294967295]"},
{"[-128..127]", "[-32168..32767]", "[-8388608..8388607]", "[-2147483648..2147483647]"}};
u32 searchRange[4][2] = {
{ 0, 255 },
{ 0, 65536 },
{ 0, 16777215 },
{ 0, 4294967295 }
};
LRESULT CALLBACK EditValueProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
// TODO: check paste
if (msg == WM_CHAR)
{
switch (wParam)
{
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
break;
case '-':
{
u8 pos = 0;
SendMessage(hwnd, EM_GETSEL, (WPARAM)&pos, NULL);
if (pos != 0) wParam = 0;
}
break;
case VK_BACK:
break;
default:
wParam = 0;
break;
}
}
return CallWindowProc(oldEditProc, hwnd, msg, wParam, lParam);
}
LRESULT CALLBACK EditValueHEXProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
// TODO: check paste
if (msg == WM_CHAR)
{
switch (wParam)
{
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
case 'A':
case 'B':
case 'C':
case 'D':
case 'E':
case 'F':
break;
case 'a':
case 'b':
case 'c':
case 'd':
case 'e':
case 'f':
wParam -= 32;
break;
case VK_BACK:
break;
default:
wParam = 0;
break;
}
}
return CallWindowProc(oldEditProcHEX, hwnd, msg, wParam, lParam);
}
BOOL CALLBACK CheatsAddProc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
{
static WNDPROC saveOldEditProc = NULL;
switch(msg)
{
case WM_INITDIALOG:
{
saveOldEditProc = oldEditProc;
SendMessage(GetDlgItem(dialog, IDC_EDIT1), EM_SETLIMITTEXT, 6, 0);
SendMessage(GetDlgItem(dialog, IDC_EDIT2), EM_SETLIMITTEXT, 10, 0);
SendMessage(GetDlgItem(dialog, IDC_EDIT3), EM_SETLIMITTEXT, 75, 0);
oldEditProcHEX = (WNDPROC)SetWindowLongPtr(GetDlgItem(dialog, IDC_EDIT1), GWLP_WNDPROC, (LONG)EditValueHEXProc);
oldEditProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(dialog, IDC_EDIT2), GWLP_WNDPROC, (LONG)EditValueProc);
if (searchAddMode == 1)
{
char buf[10];
searchAddAddress &= 0x00FFFFFF;
wsprintf(buf, "%06X", searchAddAddress);
SetWindowText(GetDlgItem(dialog, IDC_EDIT1), buf);
wsprintf(buf, "%i", searchAddValue);
SetWindowText(GetDlgItem(dialog, IDC_EDIT2), buf);
EnableWindow(GetDlgItem(dialog, IDOK), TRUE);
if (searchAddProc)
CheckDlgButton(dialog, IDC_RADIO9, BST_CHECKED);
else
CheckDlgButton(dialog, IDC_RADIO8, BST_CHECKED);
EnableWindow(GetDlgItem(dialog, IDC_EDIT1), FALSE);
EnableWindow(GetDlgItem(dialog, IDC_RADIO1), FALSE);
EnableWindow(GetDlgItem(dialog, IDC_RADIO2), FALSE);
EnableWindow(GetDlgItem(dialog, IDC_RADIO3), FALSE);
EnableWindow(GetDlgItem(dialog, IDC_RADIO4), FALSE);
EnableWindow(GetDlgItem(dialog, IDC_RADIO8), FALSE);
EnableWindow(GetDlgItem(dialog, IDC_RADIO9), FALSE);
ltoa(searchAddProc, editBuf[3], 10);
strcpy(editBuf[3], "0");
}
else
{
SetWindowText(GetDlgItem(dialog, IDC_EDIT2), "0");
CheckDlgButton(dialog, IDC_RADIO1, BST_CHECKED);
strcpy(editBuf[3], "0");
}
memset(editBuf, 0, sizeof(editBuf));
GetWindowText(GetDlgItem(dialog, IDC_EDIT1), editBuf[0], 10);
GetWindowText(GetDlgItem(dialog, IDC_EDIT2), editBuf[1], 10);
CheckDlgButton(dialog, IDC_CHECK1, BST_CHECKED);
CheckDlgButton(dialog, searchSizeIDDs[searchAddSize], BST_CHECKED);
}
return TRUE;
case WM_COMMAND:
{
switch (LOWORD(wparam))
{
case IDOK:
{
u32 tmp_addr = 0;
sscanf_s(editBuf[0], "%x", &tmp_addr);
oldEditProc = saveOldEditProc;
if (cheatsAdd(atol(editBuf[3]), searchAddSize, tmp_addr, atol(editBuf[1]), editBuf[2], searchAddFreeze))
{
if (cheatsSave())
EndDialog(dialog, TRUE);
}
}
return TRUE;
case IDCANCEL:
oldEditProc = saveOldEditProc;
EndDialog(dialog, FALSE);
return TRUE;
case IDC_EDIT1:
{
if (HIWORD(wparam) == EN_UPDATE)
{
GetWindowText(GetDlgItem(dialog, IDC_EDIT1), editBuf[0], 8);
if (!strlen(editBuf[0]) && !strlen(editBuf[1]))
{
EnableWindow(GetDlgItem(dialog, IDOK), FALSE);
return TRUE;
}
u32 val = 0;
sscanf_s(editBuf[0], "%x", &val);
val &= 0x00FFFFFF;
if (val > 0x400000)
{
EnableWindow(GetDlgItem(dialog, IDOK), FALSE);
return TRUE;
}
EnableWindow(GetDlgItem(dialog, IDOK), TRUE);
}
return TRUE;
}
case IDC_EDIT2:
{
if (HIWORD(wparam) == EN_UPDATE)
{
GetWindowText(GetDlgItem(dialog, IDC_EDIT1), editBuf[1], 10);
if (!strlen(editBuf[1]) && !strlen(editBuf[0]))
{
EnableWindow(GetDlgItem(dialog, IDOK), FALSE);
return TRUE;
}
u32 val = atol(editBuf[1]);
if (val > searchRange[searchAddSize][1])
{
EnableWindow(GetDlgItem(dialog, IDOK), FALSE);
return TRUE;
}
EnableWindow(GetDlgItem(dialog, IDOK), TRUE);
}
return TRUE;
}
case IDC_EDIT3:
{
if (HIWORD(wparam) == EN_UPDATE)
GetWindowText(GetDlgItem(dialog, IDC_EDIT3), editBuf[2], 75);
return TRUE;
}
case IDC_RADIO8:
{
strcpy(editBuf[3], "0");
return TRUE;
}
case IDC_RADIO9:
{
strcpy(editBuf[3], "1");
return TRUE;
}
case IDC_RADIO1: // 1 byte
searchAddSize = 0;
return TRUE;
case IDC_RADIO2: // 2 bytes
searchAddSize = 1;
return TRUE;
case IDC_RADIO3: // 3 bytes
searchAddSize = 2;
return TRUE;
case IDC_RADIO4: // 4 bytes
searchAddSize = 3;
return TRUE;
case IDC_CHECK1:
{
if (IsDlgButtonChecked(dialog, IDC_CHECK1) == BST_CHECKED)
searchAddFreeze = 1;
else
searchAddFreeze = 0;
}
}
}
}
return FALSE;
}
//==============================================================================
BOOL CALLBACK CheatsListBox_Proc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
{
switch(msg)
{
case WM_INITDIALOG:
{
LV_COLUMN lvColumn;
u8 proc = 0;
u32 address = 0;
u32 val = 0;
cheatListView = GetDlgItem(dialog, IDC_LIST1);
ListView_SetExtendedListViewStyle(cheatListView, LVS_EX_FULLROWSELECT);
memset(&lvColumn,0,sizeof(LV_COLUMN));
lvColumn.mask=LVCF_FMT|LVCF_WIDTH|LVCF_TEXT;
lvColumn.fmt=LVCFMT_CENTER;
lvColumn.cx=20;
lvColumn.pszText="X";
ListView_InsertColumn(cheatListView, 0, &lvColumn);
lvColumn.fmt=LVCFMT_LEFT;
lvColumn.cx=84;
lvColumn.pszText="Address";
ListView_InsertColumn(cheatListView, 1, &lvColumn);
lvColumn.cx=100;
lvColumn.pszText="Value";
ListView_InsertColumn(cheatListView, 2, &lvColumn);
lvColumn.cx=200;
lvColumn.pszText="Description";
ListView_InsertColumn(cheatListView, 3, &lvColumn);
lvColumn.fmt=LVCFMT_CENTER;
lvColumn.cx=45;
lvColumn.pszText="CPU";
ListView_InsertColumn(cheatListView, 4, &lvColumn);
LVITEM lvi;
memset(&lvi,0,sizeof(LVITEM));
lvi.mask = LVIF_TEXT|LVIF_STATE;
lvi.iItem = INT_MAX;
cheatsGetListReset();
SendMessage(cheatListView, WM_SETREDRAW, (WPARAM)FALSE,0);
while (cheatsGetList(&tempCheat))
{
char buf[256];
if (tempCheat.enabled)
lvi.pszText= "X";
else
lvi.pszText= "";
u32 row = ListView_InsertItem(cheatListView, &lvi);
wsprintf(buf, "0x02%06X", tempCheat.hi[0]);
ListView_SetItemText(cheatListView, row, 1, buf);
ltoa(tempCheat.lo[0], buf, 10);
ListView_SetItemText(cheatListView, row, 2, buf);
ListView_SetItemText(cheatListView, row, 3, tempCheat.description);
ListView_SetItemText(cheatListView, row, 4, NAME_CPUs[tempCheat.proc]);
}
SendMessage(cheatListView, WM_SETREDRAW, (WPARAM)TRUE,0);
ListView_SetItemState(searchListView,0, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED);
SetFocus(searchListView);
return TRUE;
}
case WM_COMMAND:
{
switch (LOWORD(wparam))
{
case IDOK:
case IDCANCEL:
EndDialog(dialog, FALSE);
return TRUE;
case IDC_BADD:
{
searchAddProc = 0;
searchAddAddress = 0;;
searchAddValue = 0;
searchAddMode = 0;
searchAddFreeze = 1;
if (DialogBox(hAppInst, MAKEINTRESOURCE(IDD_CHEAT_ADD), dialog, (DLGPROC) CheatsAddProc))
{
LVITEM lvi;
char buf[256];
memset(&lvi,0,sizeof(LVITEM));
lvi.mask = LVIF_TEXT|LVIF_STATE;
lvi.iItem = INT_MAX;
if (searchAddFreeze)
lvi.pszText= "X";
else
lvi.pszText= "";
u32 row = ListView_InsertItem(cheatListView, &lvi);
wsprintf(buf, "0x02%06X", searchAddAddress);
ListView_SetItemText(cheatListView, row, 1, buf);
ltoa(searchAddValue, buf, 10);
ListView_SetItemText(cheatListView, row, 2, buf);
ListView_SetItemText(cheatListView, row, 3, editBuf[2]);
ListView_SetItemText(cheatListView, row, 4, NAME_CPUs[searchAddProc]);
EnableWindow(GetDlgItem(dialog, IDOK), TRUE);
}
}
return TRUE;
}
break;
}
}
return FALSE;
}
void CheatsListDialog(HWND hwnd)
{
if (!cheatsPush()) return;
memset(&tempCheat, 0, sizeof(CHEATS_LIST));
u32 res=DialogBox(hAppInst, MAKEINTRESOURCE(IDD_CHEAT_LIST), hwnd, (DLGPROC) CheatsListBox_Proc);
if (res)
{
cheatsSave();
cheatsStackClear();
}
else
{
cheatsPop();
}
}
// ================================================================================== Search
BOOL CALLBACK CheatsSearchExactWnd(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
{
switch(msg)
{
case WM_INITDIALOG:
{
EnableWindow(hBRestart, TRUE);
if (searchNumberResults)
EnableWindow(hBView, TRUE);
else
EnableWindow(hBView, FALSE);
EnableWindow(hBSearch, FALSE);
SendMessage(GetDlgItem(dialog, IDC_EVALUE), EM_SETLIMITTEXT, 10, 0);
SetWindowText(GetDlgItem(dialog, IDC_STATIC_RANGE), searchRangeText[searchSign][searchSize]);
oldEditProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(dialog, IDC_EVALUE), GWLP_WNDPROC, (LONG)EditValueProc);
char buf[256];
ltoa(searchNumberResults, buf, 10);
SetWindowText(GetDlgItem(dialog, IDC_SNUMBER), buf);
SetFocus(GetDlgItem(dialog, IDC_EVALUE));
return TRUE;
}
case WM_COMMAND:
{
switch (LOWORD(wparam))
{
case IDC_EVALUE:
{
if (HIWORD(wparam) == EN_UPDATE)
{
char buf[10];
GetWindowText(GetDlgItem(dialog, IDC_EVALUE), buf, 10);
if (!strlen(buf))
{
EnableWindow(hBSearch, FALSE);
return TRUE;
}
u32 val = atol(buf);
if (val > searchRange[searchSize][1])
{
EnableWindow(hBSearch, FALSE);
return TRUE;
}
EnableWindow(hBSearch, TRUE);
exactVal = val;
}
return TRUE;
}
}
break;
}
}
return FALSE;
}
BOOL CALLBACK CheatsSearchCompWnd(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
{
switch(msg)
{
case WM_INITDIALOG:
{
EnableWindow(hBRestart, TRUE);
if (searchNumberResults)
EnableWindow(hBView, TRUE);
else
EnableWindow(hBView, FALSE);
EnableWindow(hBSearch, TRUE);
CheckDlgButton(dialog, searchCompIDDs[searchComp], BST_CHECKED);
char buf[256];
ltoa(searchNumberResults, buf, 10);
SetWindowText(GetDlgItem(dialog, IDC_SNUMBER), buf);
return TRUE;
}
case WM_COMMAND:
{
switch (LOWORD(wparam))
{
case IDC_RADIO1: searchComp = 0; break;
case IDC_RADIO2: searchComp = 1; break;
case IDC_RADIO3: searchComp = 2; break;
case IDC_RADIO4: searchComp = 3; break;
}
break;
}
}
return FALSE;
}
BOOL CALLBACK CheatsSearchResultWnd(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
{
switch(msg)
{
case WM_INITDIALOG:
{
EnableWindow(hBRestart, TRUE);
if (searchNumberResults)
EnableWindow(hBView, TRUE);
else
EnableWindow(hBView, FALSE);
EnableWindow(hBSearch, FALSE);
char buf[256];
ltoa(searchNumberResults, buf, 10);
SetWindowText(GetDlgItem(dialog, IDC_SNUMBER), buf);
return TRUE;
}
}
return FALSE;
}
BOOL CALLBACK CheatsSearchViewWnd(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
{
switch(msg)
{
case WM_INITDIALOG:
{
LV_COLUMN lvColumn;
u8 proc = 0;
u32 address = 0;
u32 val = 0;
searchListView = GetDlgItem(dialog, IDC_LIST);
ListView_SetExtendedListViewStyle(searchListView, LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);
memset(&lvColumn,0,sizeof(LV_COLUMN));
lvColumn.mask=LVCF_FMT|LVCF_WIDTH|LVCF_TEXT;
lvColumn.fmt=LVCFMT_CENTER;
lvColumn.cx=40;
lvColumn.pszText="CPU";
ListView_InsertColumn(searchListView, 0, &lvColumn);
lvColumn.fmt=LVCFMT_LEFT;
lvColumn.cx=84;
lvColumn.pszText="Address";
ListView_InsertColumn(searchListView, 1, &lvColumn);
lvColumn.cx=100;
lvColumn.pszText="Value";
ListView_InsertColumn(searchListView, 2, &lvColumn);
LVITEM lvi;
memset(&lvi,0,sizeof(LVITEM));
lvi.mask = LVIF_TEXT|LVIF_STATE;
lvi.iItem = INT_MAX;
cheatSearchGetListReset();
SendMessage(searchListView, WM_SETREDRAW, (WPARAM)FALSE,0);
while (cheatSearchGetList(&proc, &address, &val))
{
char buf[256];
char buf2[256];
wsprintf(buf, "0x02%06X", address);
_ltoa(val, buf2, 10);
lvi.pszText= NAME_CPUs[proc];
u32 row = SendMessage(searchListView, LVM_INSERTITEM, 0, (LPARAM)&lvi);
ListView_SetItemText(searchListView, row, 1, buf);
ListView_SetItemText(searchListView, row, 2, buf2);
}
SendMessage(searchListView, WM_SETREDRAW, (WPARAM)TRUE,0);
ListView_SetItemState(searchListView,0, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED);
SetFocus(searchListView);
}
return TRUE;
case WM_COMMAND:
{
switch (LOWORD(wparam))
{
case IDCANCEL:
ListView_DeleteAllItems(searchListView);
EndDialog(dialog, FALSE);
return TRUE;
case IDC_BADD:
{
u32 val = 0;
char buf[12];
u32 pos = ListView_GetNextItem(searchListView, -1, LVNI_SELECTED|LVNI_FOCUSED);
ListView_GetItemText(searchListView, pos, 0, buf, 4);
searchAddProc = (buf[3] == '7');
ListView_GetItemText(searchListView, pos, 1, buf, 12);
sscanf_s(buf, "%x", &val);
searchAddAddress = val & 0x00FFFFFF;
ListView_GetItemText(searchListView, pos, 2, buf, 12);
searchAddValue = atol(buf);
searchAddMode = 1;
searchAddSize = searchSize;
DialogBox(hAppInst, MAKEINTRESOURCE(IDD_CHEAT_ADD), dialog, (DLGPROC) CheatsAddProc);
}
return TRUE;
}
}
}
return FALSE;
}
BOOL CALLBACK CheatsSearchMainWnd(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
{
switch(msg)
{
case WM_INITDIALOG:
{
CheckDlgButton(dialog, searchSizeIDDs[searchSize], BST_CHECKED);
CheckDlgButton(dialog, searchSignIDDs[searchSign], BST_CHECKED);
CheckDlgButton(dialog, searchTypeIDDs[searchType], BST_CHECKED);
for (int i = 0; i < 4; i++)
SetWindowText(GetDlgItem(dialog, searchRangeIDDs[i]), searchRangeText[searchSign][i]);
EnableWindow(hBRestart, FALSE);
EnableWindow(hBView, FALSE);
EnableWindow(hBSearch, TRUE);
return TRUE;
}
case WM_COMMAND:
{
switch (LOWORD(wparam))
{
case IDC_RADIO1: // 1 byte
searchSize = 0;
return TRUE;
case IDC_RADIO2: // 2 bytes
searchSize = 1;
return TRUE;
case IDC_RADIO3: // 3 bytes
searchSize = 2;
return TRUE;
case IDC_RADIO4: // 4 bytes
searchSize = 3;
return TRUE;
case IDC_RADIO5: // unsigned
{
searchSign = 0;
for (int i = 0; i < 4; i++)
SetWindowText(GetDlgItem(dialog, searchRangeIDDs[i]), searchRangeText[searchSign][i]);
return TRUE;
}
case IDC_RADIO6: //signed
{
searchSign = 1;
for (int i = 0; i < 4; i++)
SetWindowText(GetDlgItem(dialog, searchRangeIDDs[i]), searchRangeText[searchSign][i]);
return TRUE;
}
case IDC_RADIO7: // exact value search
searchType = 0;
return TRUE;
case IDC_RADIO8: // comparative search
searchType = 1;
return TRUE;
}
break;
}
}
return FALSE;
}
DLGPROC CheatsSearchSubWnds[2][4] = {
{ CheatsSearchMainWnd, CheatsSearchExactWnd, CheatsSearchResultWnd, NULL },
{ CheatsSearchMainWnd, CheatsSearchResultWnd, CheatsSearchCompWnd, CheatsSearchResultWnd }
};
//==============================================================================
BOOL CALLBACK CheatsSearchProc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
{
switch(msg)
{
case WM_INITDIALOG:
{
hBRestart = GetDlgItem(dialog, IDC_BRESTART);
hBView = GetDlgItem(dialog, IDC_BVIEW);
hBSearch = GetDlgItem(dialog, IDC_BSEARCH);
searchWnd=CreateDialog(hAppInst, MAKEINTRESOURCE(searchIDDs[searchType][searchStep]),
dialog, (DLGPROC)CheatsSearchSubWnds[searchType][searchStep]);
return TRUE;
}
case WM_COMMAND:
{
switch (LOWORD(wparam))
{
case IDOK:
case IDCANCEL:
if (searchWnd) DestroyWindow(searchWnd);
EndDialog(dialog, FALSE);
return TRUE;
case IDC_BVIEW:
DialogBox(hAppInst, MAKEINTRESOURCE(IDD_CHEAT_SEARCH_VIEW), dialog, (DLGPROC)CheatsSearchViewWnd);
return TRUE;
case IDC_BSEARCH:
if (searchStep == 0)
cheatsSearchInit(searchType, searchSize, searchSign);
if (searchType == 0)
{
if (searchStep == 1)
searchNumberResults = cheatsSearchValue(exactVal);
}
else
{
if (searchStep == 2)
searchNumberResults = cheatsSearchComp(searchComp);
}
searchStep++;
if (searchWnd) DestroyWindow(searchWnd);
searchWnd=CreateDialog(hAppInst, MAKEINTRESOURCE(searchIDDs[searchType][searchStep]),
dialog, (DLGPROC)CheatsSearchSubWnds[searchType][searchStep]);
if (searchType == 0)
{
if (searchStep == 2) searchStep = 1;
}
else
{
if (searchStep == 1) searchStep = 2;
if (searchStep == 3) searchStep = 2;
}
return TRUE;
case IDC_BRESTART:
cheatsSearchClose();
searchStep = 0;
searchNumberResults = 0;
if (searchWnd) DestroyWindow(searchWnd);
searchWnd=CreateDialog(hAppInst, MAKEINTRESOURCE(searchIDDs[searchType][searchStep]),
dialog, (DLGPROC)CheatsSearchSubWnds[searchType][searchStep]);
return TRUE;
}
break;
}
}
return FALSE;
}
void CheatsSearchDialog(HWND hwnd)
{
DialogBox(hAppInst, MAKEINTRESOURCE(IDD_CHEAT_SEARCH), hwnd, (DLGPROC) CheatsSearchProc);
}
void CheatsSearchReset()
{
searchType = 0;
searchSize = 0;
searchSign = 0;
searchStep = 0;
searchComp = 0;
searchAddSize = 0;
exactVal = 0;
searchNumberResults = 0;
}

View File

@ -0,0 +1,29 @@
/* Copyright (C) 2006 yopyop
yopyop156@ifrance.com
yopyop156.ifrance.com
Copyright 2009 CrazyMax
Copyright 2009 DeSmuME team
This file is part of DeSmuME
DeSmuME is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
DeSmuME is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with DeSmuME; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "../common.h"
extern void CheatsListDialog(HWND hwnd);
extern void CheatsSearchDialog(HWND hwnd);
extern void CheatsSearchReset();

View File

@ -31,7 +31,6 @@
WNDCLASSEX wc;
HWND wndConfig;
HINSTANCE ghInstance = NULL;
u8 temp_type = 0;
u8 last_type;
char tmp_cflash_filename[MAX_PATH];
@ -99,39 +98,39 @@ BOOL CALLBACK GbaSlotCFlash(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
switch (LOWORD(wparam))
{
case IDC_BBROWSE:
{
int filterSize = 0, i = 0;
OPENFILENAME ofn;
char filename[MAX_PATH] = "",
fileFilter[512]="";
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = dialog;
{
int filterSize = 0, i = 0;
OPENFILENAME ofn;
char filename[MAX_PATH] = "",
fileFilter[512]="";
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = dialog;
strncpy (fileFilter, "Compact Flash image (*.img)|*.img||",512 - strlen(fileFilter));
strncat (fileFilter, "Any file (*.*)|*.*||",512 - strlen(fileFilter));
filterSize = strlen(fileFilter);
for (i = 0; i < filterSize; i++)
if (fileFilter[i] == '|') fileFilter[i] = '\0';
ofn.lpstrFilter = fileFilter;
ofn.nFilterIndex = 1;
ofn.lpstrFile = filename;
ofn.nMaxFile = MAX_PATH;
ofn.lpstrDefExt = "img";
ofn.Flags = OFN_NOCHANGEDIR | OFN_CREATEPROMPT;
if(!GetOpenFileName(&ofn)) return FALSE;
strncpy (fileFilter, "Compact Flash image (*.img)|*.img||",512 - strlen(fileFilter));
strncat (fileFilter, "Any file (*.*)|*.*||",512 - strlen(fileFilter));
filterSize = strlen(fileFilter);
for (i = 0; i < filterSize; i++)
if (fileFilter[i] == '|') fileFilter[i] = '\0';
ofn.lpstrFilter = fileFilter;
ofn.nFilterIndex = 1;
ofn.lpstrFile = filename;
ofn.nMaxFile = MAX_PATH;
ofn.lpstrDefExt = "img";
ofn.Flags = OFN_NOCHANGEDIR | OFN_CREATEPROMPT;
if(!GetOpenFileName(&ofn)) return FALSE;
SetWindowText(GetDlgItem(dialog, IDC_PATHIMG), filename);
strcpy(tmp_cflash_filename, filename);
if (!strlen(tmp_cflash_filename))
EnableWindow(OKbutton, FALSE);
else
EnableWindow(OKbutton, TRUE);
return FALSE;
}
SetWindowText(GetDlgItem(dialog, IDC_PATHIMG), filename);
strcpy(tmp_cflash_filename, filename);
if (!strlen(tmp_cflash_filename))
EnableWindow(OKbutton, FALSE);
else
EnableWindow(OKbutton, TRUE);
return FALSE;
}
case IDC_BBROWSE2:
{
@ -327,7 +326,7 @@ BOOL CALLBACK GbaSlotBox_Proc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
addonList[temp_type].info((char *)tmp_info);
SetWindowText(GetDlgItem(dialog, IDC_ADDONS_INFO), (char *)tmp_info);
wndConfig=CreateDialog(ghInstance, MAKEINTRESOURCE(GBAslot_IDDs[temp_type]),
wndConfig=CreateDialog(hAppInst, MAKEINTRESOURCE(GBAslot_IDDs[temp_type]),
dialog, (DLGPROC)GBAslot_Procs[temp_type]);
if (temp_type == 0)
EnableWindow(OKbutton, TRUE);
@ -349,13 +348,13 @@ BOOL CALLBACK GbaSlotBox_Proc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
}
if (Msg == IDYES)
{
if (wndConfig) CloseWindow(wndConfig);
if (wndConfig) DestroyWindow(wndConfig);
EndDialog(dialog, TRUE);
}
}
return TRUE;
case IDCANCEL:
if (wndConfig) CloseWindow(wndConfig);
if (wndConfig) DestroyWindow(wndConfig);
EndDialog(dialog, FALSE);
return TRUE;
@ -365,8 +364,8 @@ BOOL CALLBACK GbaSlotBox_Proc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
temp_type = ComboBox_GetCurSel(GetDlgItem(dialog, IDC_ADDONS_LIST));
if (temp_type != last_type)
{
if (wndConfig) CloseWindow(wndConfig);
wndConfig=CreateDialog(ghInstance,
if (wndConfig) DestroyWindow(wndConfig);
wndConfig=CreateDialog(hAppInst,
MAKEINTRESOURCE(GBAslot_IDDs[temp_type]), dialog,
(DLGPROC)GBAslot_Procs[temp_type]);
u8 tmp_info[512];
@ -383,9 +382,8 @@ BOOL CALLBACK GbaSlotBox_Proc(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam)
return FALSE;
}
void GBAslotDialog(HWND hwnd, HINSTANCE hInstance)
void GBAslotDialog(HWND hwnd)
{
ghInstance = hInstance;
temp_type = addon_type;
last_type = temp_type;
strcpy(tmp_cflash_filename, CFlashName);
@ -393,7 +391,7 @@ void GBAslotDialog(HWND hwnd, HINSTANCE hInstance)
strcpy(tmp_gbagame_filename, GBAgameName);
tmp_CFlashUseRomPath = CFlashUseRomPath;
tmp_CFlashUsePath = CFlashUsePath;
u32 res=DialogBox(hInstance, MAKEINTRESOURCE(IDD_GBASLOT), hwnd, (DLGPROC) GbaSlotBox_Proc);
u32 res=DialogBox(hAppInst, MAKEINTRESOURCE(IDD_GBASLOT), hwnd, (DLGPROC) GbaSlotBox_Proc);
if (res)
{
switch (temp_type)

View File

@ -22,5 +22,5 @@
#define __GBASLOT_CONFIG_H_
#include "../common.h"
extern void GBAslotDialog(HWND hwnd, HINSTANCE hInstance);
extern void GBAslotDialog(HWND hwnd);
#endif

View File

@ -65,6 +65,7 @@
#include "console.h"
#include "throttle.h"
#include "gbaslot_config.h"
#include "cheatsWin.h"
#include "../common.h"
@ -134,7 +135,7 @@ WINCLASS *MainWindow=NULL;
//HWND hwnd;
//HDC hdc;
HACCEL hAccel;
HINSTANCE hAppInst;
HINSTANCE hAppInst = NULL;
RECT MainWindowRect;
int WndX = 0;
int WndY = 0;
@ -1571,6 +1572,8 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
EnableMenuItem(mainMenu, IDM_RESET, MF_ENABLED);
EnableMenuItem(mainMenu, IDM_GAME_INFO, MF_ENABLED);
EnableMenuItem(mainMenu, IDM_IMPORTBACKUPMEMORY, MF_ENABLED);
EnableMenuItem(mainMenu, IDM_CHEATS_LIST, MF_ENABLED);
EnableMenuItem(mainMenu, IDM_CHEATS_SEARCH, MF_ENABLED);
romloaded = TRUE;
NDS_UnPause();
}
@ -1805,6 +1808,8 @@ void OpenRecentROM(int listNum)
EnableMenuItem(mainMenu, IDM_RESET, MF_ENABLED);
EnableMenuItem(mainMenu, IDM_GAME_INFO, MF_ENABLED);
EnableMenuItem(mainMenu, IDM_IMPORTBACKUPMEMORY, MF_ENABLED);
EnableMenuItem(mainMenu, IDM_CHEATS_LIST, MF_ENABLED);
EnableMenuItem(mainMenu, IDM_CHEATS_SEARCH, MF_ENABLED);
romloaded = TRUE;
}
@ -1901,6 +1906,8 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
EnableMenuItem(mainMenu, IDM_RESET, MF_ENABLED);
EnableMenuItem(mainMenu, IDM_GAME_INFO, MF_ENABLED);
EnableMenuItem(mainMenu, IDM_IMPORTBACKUPMEMORY, MF_ENABLED);
EnableMenuItem(mainMenu, IDM_CHEATS_LIST, MF_ENABLED);
EnableMenuItem(mainMenu, IDM_CHEATS_SEARCH, MF_ENABLED);
romloaded = TRUE;
}
NDS_UnPause();
@ -2031,6 +2038,8 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
EnableMenuItem(mainMenu, IDM_RESET, MF_ENABLED);
EnableMenuItem(mainMenu, IDM_GAME_INFO, MF_ENABLED);
EnableMenuItem(mainMenu, IDM_IMPORTBACKUPMEMORY, MF_ENABLED);
EnableMenuItem(mainMenu, IDM_CHEATS_LIST, MF_ENABLED);
EnableMenuItem(mainMenu, IDM_CHEATS_SEARCH, MF_ENABLED);
romloaded = TRUE;
NDS_UnPause();
}
@ -2413,7 +2422,15 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
return 0;
case IDM_GBASLOT:
GBAslotDialog(hwnd, hAppInst);
GBAslotDialog(hwnd);
return 0;
case IDM_CHEATS_LIST:
CheatsListDialog(hwnd);
return 0;
case IDM_CHEATS_SEARCH:
CheatsSearchDialog(hwnd);
return 0;
case ACCEL_N: //Frame Advance
@ -2484,6 +2501,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
return 0;
case IDM_RESET:
CheatsSearchReset();
NDS_Reset();
frameCounter=0;
return 0;

View File

@ -25,8 +25,11 @@
#define IDM_RESET 114
#define IDD_GBASLOT_CFLASH 114
#define IDM_IOREG 115
#define IDD_CHEAT_SEARCH_VIEW 115
#define IDM_LOG 116
#define IDD_CHEAT_LIST 116
#define IDM_PAL 117
#define IDD_CHEAT_ADD 117
#define IDM_TILE 118
#define IDM_MAP 119
#define IDM_MBG0 120
@ -104,13 +107,11 @@
#define IDC_LANGENGLISH 210
#define IDC_LANGFRENCH 211
#define IDC_LANGDANISH 212
#define IDD_MEM_VIEWER 301
#define IDC_8_BIT 302
#define IDC_16_BIT 303
#define IDC_32_BIT 304
#define IDC_MEM_BOX 305
#define IDC_GOTOMEM 306
#define IDD_DESASSEMBLEUR_VIEWER 401
#define IDC_DES_BOX 402
#define IDC_R0 403
#define IDC_R1 404
@ -237,13 +238,47 @@
#define IDC_RFILE 1038
#define IDC_RFOLDER 1039
#define IDC_BBROWSE2 1040
#define IDC_CHECK1 1041
#define IDC_PATHDESMUME 1041
#define IDC_BBUTTON01 1042
#define IDC_BRESTART 1042
#define IDC_BBUTTON02 1043
#define IDC_BVIEW 1043
#define IDC_BBUTTON03 1044
#define IDC_BSEARCH 1044
#define IDC_RADIO1 1045
#define IDC_RADIO2 1046
#define IDC_RADIO3 1047
#define IDC_RADIO4 1048
#define IDC_RADIO5 1049
#define IDC_RADIO6 1050
#define IDC_RADIO7 1051
#define IDC_RADIO8 1052
#define IDC_LIST1 1056
#define IDC_BUTTON2 1057
#define IDC_BADD_AR 1057
#define IDC_BUTTON3 1058
#define IDC_BADD_CB 1058
#define IDC_BUTTON4 1060
#define IDC_BREMOVE 1060
#define IDC_BUTTON5 1061
#define IDC_STATIC_S1 1061
#define IDC_BEDIT 1061
#define IDC_STATIC_S2 1062
#define IDC_STATIC_S3 1063
#define IDC_STATIC_S4 1064
#define IDC_EVALUE 1065
#define IDC_STATIC_RANGE 1066
#define IDC_BADD 1068
#define IDC_LIST 1069
#define IDC_SNUMBER 1071
#define IDC_CHECK1 1074
#define IDC_RADIO9 1075
#define IDM_FIRMSETTINGS 1100
#define IDD_FIRMSETTINGS 1101
#define IDC_EDIT1 1102
#define IDC_EDIT2 1103
#define IDC_EDIT13 1104
#define IDC_EDIT3 1104
#define IDC_EDIT14 1105
#define IDD_MATRIX_VIEWER 1200
#define IDM_MATRIX_VIEWER 1200
@ -330,10 +365,17 @@
#define IDD_GBASLOT_NONE 1304
#define IDD_GBASLOT_RUMBLEPAK 1305
#define IDD_GBASLOT_GBAGAME 1306
#define IDD_CHEAT_SEARCH_COMP 1307
#define IDD_CHEAT_SEARCH_MAIN 1308
#define IDD_CHEAT_SEARCH_RESULT 1310
#define IDC_LIGHT_VIWER_LIGHT1_GROUP 1311
#define IDD_CHEAT_SEARCH_EXACT 1311
#define IDC_LIGHT_VIEWER_LIGHT1COLOR_COLORCTRL 1312
#define IDD_CHEAT_SEARCH 1312
#define IDC_LIGHT_VIEWER_LIGHT1COLOR_EDIT 1313
#define IDD_CHEAT_ADD_AR_CODE 1313
#define IDC_LIGHT_VIEWER_LIGHT1VECTOR_EDIT 1314
#define IDD_CHEAT_ADD_BC_CODE 1314
#define IDC_LIGHT_VIWER_LIGHT2_GROUP 1321
#define IDC_LIGHT_VIEWER_LIGHT2COLOR_COLORCTRL 1322
#define IDC_LIGHT_VIEWER_LIGHT2COLOR_EDIT 1323
@ -363,7 +405,6 @@
#define ID_VIEW_DISPLAYFRAMECOUNTER40009 40009
#define ID_VIEW_DISPLAYFPS 40010
#define ID_VIS_DISPLAYFPS 40011
#define ID_VIEW_DISPLAYFPS40012 40012
#define ID_FILE_RECORDAVI 40013
#define ID_FILE_STOPAVI 40014
#define IDM_FILE_RECORDAVI 40015
@ -388,14 +429,21 @@
#define IDM_3DCONFIG 40040
#define ID_EMULATION_GBASLOT 40041
#define IDM_GBASLOT 40042
#define ID_TOOLS_D 40043
#define ID_TOOLS_CHEATS 40044
#define ID_CHEATS_LIST 40045
#define ID_CHEATS_SEARCH 40046
#define ID_EMULATION_CHEATS 40047
#define IDM_CHEATS_LIST 40050
#define IDM_CHEATS_SEARCH 40051
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 115
#define _APS_NEXT_COMMAND_VALUE 40043
#define _APS_NEXT_CONTROL_VALUE 1042
#define _APS_NEXT_RESOURCE_VALUE 118
#define _APS_NEXT_COMMAND_VALUE 40052
#define _APS_NEXT_CONTROL_VALUE 1076
#define _APS_NEXT_SYMED_VALUE 112
#endif
#endif

View File

@ -135,6 +135,11 @@ BEGIN
MENUITEM "&Genstart", IDM_RESET
MENUITEM SEPARATOR
MENUITEM "GBA &slot", IDM_GBASLOT
POPUP "&Cheats"
BEGIN
MENUITEM "&List", IDM_CHEATS_LIST, INACTIVE
MENUITEM "&Search", IDM_CHEATS_SEARCH, INACTIVE
END
END
POPUP "&Vis"
BEGIN
@ -798,6 +803,11 @@ BEGIN
MENUITEM "&Reset", IDM_RESET
MENUITEM SEPARATOR
MENUITEM "GBA &slot", IDM_GBASLOT
POPUP "&Cheats"
BEGIN
MENUITEM "&List", IDM_CHEATS_LIST, INACTIVE
MENUITEM "&Search", IDM_CHEATS_SEARCH, INACTIVE
END
END
POPUP "&View"
BEGIN
@ -1534,6 +1544,153 @@ BEGIN
CTEXT "Select file name for GBA game rom:",IDC_STATIC,7,7,288,14
END
IDD_CHEAT_SEARCH_VIEW DIALOGEX 0, 0, 177, 211
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Cheat search - Results"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CONTROL "",IDC_LIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,7,163,180
PUSHBUTTON "Return",IDCANCEL,64,190,50,14
DEFPUSHBUTTON "Add",IDC_BADD,120,190,50,14
END
IDD_CHEAT_SEARCH_COMP DIALOGEX 0, 0, 177, 184
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE | WS_SYSMENU
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
RTEXT "number of results: ",IDC_STATIC,7,169,78,8
LTEXT "Static",IDC_SNUMBER,92,169,78,8
GROUPBOX " Select comparison ",IDC_STATIC,7,7,163,58
CONTROL "new value is > old value",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON | WS_GROUP,9,17,93,10
CONTROL "new value is < old value",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,9,28,93,10
CONTROL "new value is = old value",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,9,39,93,10
CONTROL "new value is != old value",IDC_RADIO4,"Button",BS_AUTORADIOBUTTON,9,50,96,10
END
IDD_CHEAT_SEARCH_MAIN DIALOGEX 0, 0, 178, 185
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE | WS_SYSMENU
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CONTROL "1 byte",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON | WS_GROUP,9,10,37,10
CONTROL "2 bytes",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,9,20,40,10
CONTROL "3 bytes",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,9,31,40,10
CONTROL "4 bytes",IDC_RADIO4,"Button",BS_AUTORADIOBUTTON,9,42,40,10
CONTROL "Unsigned",IDC_RADIO5,"Button",BS_AUTORADIOBUTTON | WS_GROUP,9,74,45,10
CONTROL "Signed",IDC_RADIO6,"Button",BS_AUTORADIOBUTTON,9,85,37,10
GROUPBOX " Select size ",IDC_STATIC,7,0,164,57
GROUPBOX " Sign ",IDC_STATIC,7,62,164,37
GROUPBOX " Select search type ",IDC_STATIC,7,104,164,33
CONTROL "Exact value search",IDC_RADIO7,"Button",BS_AUTORADIOBUTTON | WS_GROUP,9,114,77,10
CONTROL "Comparative search",IDC_RADIO8,"Button",BS_AUTORADIOBUTTON,9,125,80,10
LTEXT "[0..255]",IDC_STATIC_S1,53,10,118,8
LTEXT "[0..65535]",IDC_STATIC_S2,53,20,118,8
LTEXT "[0..16777215]",IDC_STATIC_S3,53,31,118,8
LTEXT "[0..4294967295]",IDC_STATIC_S4,53,41,118,8
END
IDD_CHEAT_SEARCH_RESULT DIALOGEX 0, 0, 177, 184
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE | WS_SYSMENU
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
LTEXT "Now return to your game and come back when the next search should be processed",IDC_STATIC,7,7,163,20
RTEXT "number of results: ",IDC_STATIC,7,169,78,8
LTEXT "Static",IDC_SNUMBER,92,169,78,8
END
IDD_CHEAT_SEARCH_EXACT DIALOGEX 0, 0, 177, 184
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE | WS_SYSMENU
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
EDITTEXT IDC_EVALUE,7,18,163,14,ES_AUTOHSCROLL
LTEXT "Enter value:",IDC_STATIC,7,7,163,8
RTEXT "Range value:",IDC_STATIC,7,36,78,8
LTEXT "Static",IDC_STATIC_RANGE,92,36,78,8
RTEXT "number of results: ",IDC_STATIC,7,169,78,8
LTEXT "Static",IDC_SNUMBER,92,169,78,8
END
IDD_CHEAT_LIST DIALOGEX 0, 0, 316, 177
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Cheats list"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CONTROL "",IDC_LIST1,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,7,302,103
PUSHBUTTON "internal",IDC_BADD,10,125,50,14
PUSHBUTTON "Action Replay",IDC_BADD_AR,66,125,67,14,WS_DISABLED
PUSHBUTTON "Codebreaker",IDC_BADD_CB,139,125,67,14,WS_DISABLED
PUSHBUTTON "Edit",IDC_BEDIT,245,113,64,14,WS_DISABLED
PUSHBUTTON "Remove",IDC_BREMOVE,246,129,63,14,WS_DISABLED
DEFPUSHBUTTON "Save",IDOK,109,156,50,14,WS_DISABLED
PUSHBUTTON "Cancel",IDCANCEL,163,156,50,14
GROUPBOX " Add cheats code as... ",IDC_STATIC,7,114,205,31
END
IDD_CHEAT_SEARCH DIALOGEX 0, 0, 177, 211
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Cheat search"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
PUSHBUTTON "Restart",IDC_BRESTART,7,190,50,14,WS_DISABLED
PUSHBUTTON "View",IDC_BVIEW,64,190,50,14,WS_DISABLED
DEFPUSHBUTTON "Search",IDC_BSEARCH,120,190,50,14
END
IDD_CHEAT_ADD DIALOGEX 0, 0, 121, 207
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Add cheat"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
EDITTEXT IDC_EDIT1,26,17,88,14,ES_AUTOHSCROLL
EDITTEXT IDC_EDIT2,7,53,107,14,ES_AUTOHSCROLL
EDITTEXT IDC_EDIT3,7,78,107,30,ES_MULTILINE
CONTROL "freeze value",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,47,112,67,10
CONTROL "1 byte",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON | WS_GROUP,9,135,37,10
CONTROL "2 bytes",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,9,145,40,10
CONTROL "3 bytes",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,9,156,40,10
CONTROL "4 bytes",IDC_RADIO4,"Button",BS_AUTORADIOBUTTON,9,167,40,10
DEFPUSHBUTTON "Add",IDOK,7,186,50,14,WS_DISABLED
PUSHBUTTON "Cancel",IDCANCEL,64,186,50,14
CONTROL "ARM9",IDC_RADIO8,"Button",BS_AUTORADIOBUTTON | WS_GROUP,23,34,35,10
CONTROL "ARM7",IDC_RADIO9,"Button",BS_AUTORADIOBUTTON,64,34,35,10
LTEXT "Address:",IDC_STATIC,9,9,30,8
LTEXT "Value:",IDC_STATIC,9,45,21,8
LTEXT "Description:",IDC_STATIC,9,70,39,8
LTEXT "0x02",IDC_STATIC,7,19,17,8
GROUPBOX " Select size ",IDC_STATIC,7,125,107,57
LTEXT "[0..255]",IDC_STATIC_S1,53,135,60,8
LTEXT "[0..65535]",IDC_STATIC_S2,53,145,60,8
LTEXT "[0..16777215]",IDC_STATIC_S3,53,156,58,8
LTEXT "[0..4294967295]",IDC_STATIC_S4,53,166,59,8
END
IDD_CHEAT_ADD_AR_CODE DIALOGEX 0, 0, 121, 193
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Add Action Replay code"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
EDITTEXT IDC_EDIT2,7,17,107,97,ES_AUTOHSCROLL
EDITTEXT IDC_EDIT3,7,124,107,30,ES_MULTILINE
CONTROL "turn on code",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,47,159,67,10
DEFPUSHBUTTON "Add",IDOK,7,172,50,14
PUSHBUTTON "Cancel",IDCANCEL,64,172,50,14
LTEXT "Code:",-1,7,7,20,8
LTEXT "Description:",-1,9,116,39,8
END
IDD_CHEAT_ADD_BC_CODE DIALOGEX 0, 0, 121, 193
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Add Action Replay code"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
EDITTEXT IDC_EDIT2,7,17,107,97,ES_AUTOHSCROLL
EDITTEXT IDC_EDIT3,7,124,107,30,ES_MULTILINE
CONTROL "turn on code",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,47,159,67,10
DEFPUSHBUTTON "Add",IDOK,7,172,50,14
PUSHBUTTON "Cancel",IDCANCEL,64,172,50,14
LTEXT "Code:",-1,7,7,20,8
LTEXT "Description:",-1,9,116,39,8
END
/////////////////////////////////////////////////////////////////////////////
//
@ -1633,6 +1790,86 @@ BEGIN
TOPMARGIN, 7
BOTTOMMARGIN, 102
END
IDD_CHEAT_SEARCH_VIEW, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 170
TOPMARGIN, 7
BOTTOMMARGIN, 204
END
IDD_CHEAT_SEARCH_COMP, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 170
TOPMARGIN, 7
BOTTOMMARGIN, 177
END
IDD_CHEAT_SEARCH_MAIN, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 171
TOPMARGIN, 7
BOTTOMMARGIN, 178
END
IDD_CHEAT_SEARCH_RESULT, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 170
TOPMARGIN, 7
BOTTOMMARGIN, 177
END
IDD_CHEAT_SEARCH_EXACT, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 170
TOPMARGIN, 7
BOTTOMMARGIN, 177
END
IDD_CHEAT_LIST, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 309
TOPMARGIN, 7
BOTTOMMARGIN, 170
END
IDD_CHEAT_SEARCH, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 170
TOPMARGIN, 7
BOTTOMMARGIN, 204
END
IDD_CHEAT_ADD, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 114
TOPMARGIN, 7
BOTTOMMARGIN, 200
END
IDD_CHEAT_ADD_AR_CODE, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 114
TOPMARGIN, 7
BOTTOMMARGIN, 186
END
IDD_CHEAT_ADD_BC_CODE, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 114
TOPMARGIN, 7
BOTTOMMARGIN, 186
END
END
#endif // APSTUDIO_INVOKED
@ -1707,6 +1944,11 @@ BEGIN
MENUITEM "&Reset", IDM_RESET
MENUITEM SEPARATOR
MENUITEM "GBA &slot", IDM_GBASLOT
POPUP "&Cheats"
BEGIN
MENUITEM "&List", IDM_CHEATS_LIST, INACTIVE
MENUITEM "&Search", IDM_CHEATS_SEARCH, INACTIVE
END
END
POPUP "&View"
BEGIN