Merge branch 'master' into linux-cheats

This commit is contained in:
Matthew Budd 2020-05-09 09:32:10 -04:00
commit f4985e4add
22 changed files with 1508 additions and 1147 deletions

View File

@ -132,6 +132,11 @@ void SetupCartCHRMapping(int chip, uint8 *p, uint32 size, int ram) {
CHRmask4[chip] = (size >> 12) - 1;
CHRmask8[chip] = (size >> 13) - 1;
if (CHRmask1[chip] >= (unsigned int)(-1)) CHRmask1[chip] = 0;
if (CHRmask2[chip] >= (unsigned int)(-1)) CHRmask2[chip] = 0;
if (CHRmask4[chip] >= (unsigned int)(-1)) CHRmask4[chip] = 0;
if (CHRmask8[chip] >= (unsigned int)(-1)) CHRmask8[chip] = 0;
CHRram[chip] = ram;
}

View File

@ -39,7 +39,6 @@ using namespace std;
static uint8 *CheatRPtrs[64];
vector<uint16> FrozenAddresses; //List of addresses that are currently frozen
void UpdateFrozenList(void); //Function that populates the list of frozen addresses
unsigned int FrozenAddressCount = 0; //Keeps up with the Frozen address count, necessary for using in other dialogs (such as hex editor)
void FCEU_CheatResetRAM(void)
@ -64,6 +63,7 @@ CHEATF_SUBFAST SubCheats[256] = { 0 };
uint32 numsubcheats = 0;
int globalCheatDisabled = 0;
int disableAutoLSCheats = 0;
static _8BYTECHEATMAP* cheatMap = NULL;
struct CHEATF *cheats = 0, *cheatsl = 0;
@ -102,11 +102,17 @@ void RebuildSubCheats(void)
{
uint32 x;
struct CHEATF *c = cheats;
for(x = 0; x < numsubcheats; x++)
for (x = 0; x < numsubcheats; x++)
{
SetReadHandler(SubCheats[x].addr, SubCheats[x].addr, SubCheats[x].PrevRead);
if (cheatMap)
FCEUI_SetCheatMapByte(SubCheats[x].addr, false);
}
numsubcheats = 0;
if (!globalCheatDisabled)
{
while(c)
{
if(c->type == 1 && c->status && GetReadHandler(c->addr) != SubCheatsRead)
@ -116,27 +122,32 @@ void RebuildSubCheats(void)
SubCheats[numsubcheats].val = c->val;
SubCheats[numsubcheats].compare = c->compare;
SetReadHandler(c->addr, c->addr, SubCheatsRead);
if (cheatMap)
FCEUI_SetCheatMapByte(SubCheats[numsubcheats].addr, true);
numsubcheats++;
}
c = c->next;
}
}
FrozenAddressCount = numsubcheats; //Update the frozen address list
UpdateFrozenList();
}
void FCEU_PowerCheats()
{
numsubcheats = 0; /* Quick hack to prevent setting of ancient read addresses. */
if (cheatMap)
FCEUI_RefreshCheatMap();
RebuildSubCheats();
}
int FCEU_CalcCheatAffectedBytes(uint32 address, uint32 size) {
uint32 count = 0;
for (uint32 i = 0; i < numsubcheats && count < size; ++i)
if (SubCheats[i].addr >= address && SubCheats[i].addr < address + size)
++count;
if (cheatMap)
for (uint32 i = 0; i < size; ++i)
if (FCEUI_FindCheatMapByte(address + i))
++count;
return count;
}
@ -195,9 +206,12 @@ void FCEU_LoadGameCheats(FILE *override, int override_existing)
int tc = 0;
char *fn;
savecheats = 0;
if (override_existing)
{
numsubcheats = 0;
if (cheatMap)
FCEUI_RefreshCheatMap();
}
if(override)
fp = override;
@ -870,22 +884,6 @@ void FCEU_CheatSetByte(uint32 A, uint8 V)
BWrite[A](A, V);
}
void UpdateFrozenList(void)
{
//The purpose of this function is to keep an up to date list of addresses that are currently frozen
//and make these accessible to other dialogs that deal with memory addresses such as
//memwatch, hex editor, ramfilter, etc.
uint32 x;
FrozenAddresses.clear(); //Clear vector and repopulate
for(x = 0; x < numsubcheats; x++)
{
FrozenAddresses.push_back(SubCheats[x].addr);
//FCEU_printf("Address %d: %d \n",x,FrozenAddresses[x]); //Debug
}
//FCEUI_DispMessage("FrozenCount: %d",0,FrozenAddressCount);//Debug
}
// disable all cheats
int FCEU_DisableAllCheats(){
int count = 0;
@ -902,3 +900,36 @@ int FCEU_DisableAllCheats(){
RebuildSubCheats();
return count;
}
inline int FCEUI_FindCheatMapByte(uint16 address)
{
return cheatMap[address / 8] >> (address % 8) & 1;
}
inline void FCEUI_SetCheatMapByte(uint16 address, bool cheat)
{
cheat ? cheatMap[address / 8] |= (1 << address % 8) : cheatMap[address / 8] ^= (1 << address % 8);
}
inline void FCEUI_CreateCheatMap()
{
if (!cheatMap)
cheatMap = (unsigned char*)malloc(CHEATMAP_SIZE);
FCEUI_RefreshCheatMap();
}
inline void FCEUI_RefreshCheatMap()
{
memset(cheatMap, 0, CHEATMAP_SIZE);
for (int i = 0; i < numsubcheats; ++i)
FCEUI_SetCheatMapByte(SubCheats[i].addr, true);
}
inline void FCEUI_ReleaseCheatMap()
{
if (cheatMap)
{
free(cheatMap);
cheatMap = NULL;
}
}

View File

@ -11,6 +11,16 @@ void FCEU_ApplyPeriodicCheats(void);
void FCEU_PowerCheats(void);
int FCEU_CalcCheatAffectedBytes(uint32 address, uint32 size);
// Trying to find a more efficient way for determining if an address has a cheat
// each bit of 1 byte represents to 8 bytes in NES
typedef unsigned char _8BYTECHEATMAP;
#define CHEATMAP_SIZE 0x10000 / 8
extern int FCEUI_FindCheatMapByte(uint16 address);
extern void FCEUI_SetCheatMapByte(uint16 address, bool cheat);
extern void FCEUI_CreateCheatMap();
extern void FCEUI_RefreshCheatMap();
extern void FCEUI_ReleaseCheatMap();
int FCEU_CheatGetByte(uint32 A);
void FCEU_CheatSetByte(uint32 A, uint8 V);
@ -55,10 +65,4 @@ struct SEARCHPOSSIBLE {
#define FCEU_SEARCH_NEWVAL_GT_KNOWN 7
#define FCEU_SEARCH_NEWVAL_LT_KNOWN 8
#define CalcAddressRangeCheatCount(count, address, size) \
count = 0; \
for (int i = 0; i < numsubcheats && count < size; ++i) \
if (SubCheats[i].addr >= address && SubCheats[i].addr < address + size) \
++count
#endif

View File

@ -30,7 +30,8 @@
#include <map>
// static HWND pwindow = 0; // owomomo: removed pwindow because ambiguous, perhaps it is some obseleted early future plan from half developed old FCEUX?
HWND hCheat = 0; //Handle to Cheats dialog
HWND hCheat = 0; //Handle to Cheats dialog
HWND hCheatTip = 0; //Handle to tooltip
HMENU hCheatcontext = 0; //Handle to cheat context menu
bool pauseWhileActive = false; //For checkbox "Pause while active"
@ -40,6 +41,7 @@ extern bool wasPausedByCheats;
int CheatWindow;
int CheatStyle = 1;
int CheatMapUsers = 0; // how many windows using cheatmap
#define GGLISTSIZE 128 //hopefully this is enough for all cases
@ -72,7 +74,7 @@ char* GameGenieLetters = "APZLGITYEOXUKSVN";
// bool dodecode;
HWND hGGConv;
HWND hGGConv = 0;
void EncodeGG(char *str, int a, int v, int c);
void ListGGAddresses(HWND hwndDlg);
@ -352,7 +354,8 @@ INT_PTR CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHEAT_TEXT), GWLP_WNDPROC, (LONG_PTR)FilterEditCtrlProc);
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHEAT_GAME_GENIE_TEXT), GWLP_WNDPROC, (LONG_PTR)FilterEditCtrlProc);
// Create popup to "Auto load / save with game", since it has 3 states and the text need some explanation
SetCheatToolTip(hwndDlg, IDC_CHEAT_AUTOLOADSAVE);
possiTotalCount = 0;
possiItemCount = SendDlgItemMessage(hwndDlg, IDC_CHEAT_LIST_POSSIBILITIES, LVM_GETCOUNTPERPAGE, 0, 0);
@ -395,6 +398,7 @@ INT_PTR CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
break;
case WM_QUIT:
case WM_CLOSE:
DestroyWindow(hCheatTip);
if (CheatStyle)
DestroyWindow(hwndDlg);
else
@ -463,7 +467,7 @@ INT_PTR CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
break;
case WM_COMMAND:
{
static int editMode = 0;
static int editMode = -1;
switch (HIWORD(wParam))
{
@ -741,12 +745,13 @@ INT_PTR CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
}
break;
case IDC_CHEAT_AUTOLOADSAVE:
{
switch (IsDlgButtonChecked(hwndDlg, IDC_CHEAT_AUTOLOADSAVE))
{
case BST_CHECKED: disableAutoLSCheats = 0; break;
case BST_INDETERMINATE: disableAutoLSCheats = 1; break;
case BST_UNCHECKED:
if(MessageBox(hwndDlg, "If this option is unchecked, you must manually save the cheats by yourself, or all the changed you made to the cheat list would be discarded silently without any asking once you close the game!\nDo you really want to do it in this way?", "Cheat warning", MB_YESNO | MB_ICONWARNING) == IDYES)
if(MessageBox(hwndDlg, "If this option is unchecked, you must manually save the cheats by yourself, or all the changes you made to the cheat list would be discarded silently without any asking once you close the game!\nDo you really want to do it in this way?", "Cheat warning", MB_YESNO | MB_ICONWARNING | MB_DEFBUTTON2) == IDYES)
disableAutoLSCheats = 2;
else
{
@ -754,6 +759,8 @@ INT_PTR CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
CheckDlgButton(hwndDlg, IDC_CHEAT_AUTOLOADSAVE, BST_CHECKED);
}
}
SetCheatToolTip(hwndDlg, IDC_CHEAT_AUTOLOADSAVE);
}
}
break;
case EN_SETFOCUS:
@ -764,6 +771,18 @@ INT_PTR CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
case IDC_CHEAT_COM: editMode = 0; break;
case IDC_CHEAT_TEXT: editMode = 1; break;
case IDC_CHEAT_GAME_GENIE_TEXT: editMode = 2; break;
default: editMode = -1;
}
break;
case EN_KILLFOCUS:
switch (LOWORD(wParam))
{
case IDC_CHEAT_ADDR:
case IDC_CHEAT_VAL:
case IDC_CHEAT_COM:
case IDC_CHEAT_TEXT:
case IDC_CHEAT_GAME_GENIE_TEXT:
default: editMode = -1; break;
}
break;
case EN_UPDATE:
@ -1046,8 +1065,6 @@ void UpdateCheatsAdded()
INT_PTR CALLBACK GGConvCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
// int i;
extern void GetUIGGInfo(HWND hwndDlg, uint32* a, uint8* v, int* c);
switch(uMsg) {
case WM_MOVE: {
@ -1227,7 +1244,6 @@ void ListGGAddresses(HWND hwndDlg)
SendDlgItemMessage(hwndDlg, IDC_LIST_GGADDRESSES, LB_RESETCONTENT,0,0);
uint32 a = -1; uint8 v = -1; int c = -1;
extern void GetUIGGInfo(HWND hwnd, uint32* a, uint8* v, int* c);
GetUIGGInfo(hwndDlg, &a, &v, &c);
// also enable/disable the add GG button here
@ -1310,6 +1326,50 @@ inline void GetCheatCodeStr(char* buf, int a, int v, int c)
sprintf(buf, "%04X?%02X:%02X", a, c, v);
}
static void SetCheatToolTip(HWND hwndDlg, UINT id)
{
TOOLINFO info;
memset(&info, 0, sizeof(TOOLINFO));
info.cbSize = sizeof(TOOLINFO);
info.uFlags = TTF_SUBCLASS | TTF_IDISHWND;
info.hwnd = hwndDlg;
info.lpszText = GetCheatToolTipStr(hwndDlg, id);
info.uId = (UINT_PTR)GetDlgItem(hwndDlg, id);
if (hCheatTip)
SendMessage(hCheatTip, TTM_UPDATETIPTEXT, 0, (LPARAM)&info);
else
{
if (hCheatTip = CreateWindow(TOOLTIPS_CLASS, NULL, WS_POPUP | TTS_ALWAYSTIP, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hwndDlg, NULL, fceu_hInstance, NULL)) {
SendMessage(hCheatTip, TTM_ADDTOOL, 0, (LPARAM)&info);
SendMessage(hCheatTip, TTM_SETDELAYTIME, TTDT_AUTOPOP, 30000);
SendMessage(hCheatTip, TTM_SETMAXTIPWIDTH, 0, 8000);
}
}
}
char* GetCheatToolTipStr(HWND hwndDlg, UINT id)
{
switch (id)
{
case IDC_CHEAT_AUTOLOADSAVE:
switch (disableAutoLSCheats)
{
case 0: return "Automatically load/save cheat file along with the game.";
case 1: return
"Don't add cheat on game load, but prompt for saving on game closes.\r\n"
"You must manually import cht file when it's needed.";
case 2: return
"Don't add cheat on game load, and don't save cheat on game closes.\r\n"
"You must manually import/export cht file by yourself,\nor all your changes to cheat will be lost!";
default:
return "Mysterious undocumented state.";
}
}
return NULL;
}
void GetUICheatInfo(HWND hwndDlg, char* name, uint32* a, uint8* v, int* c)
{
char buf[16];
@ -1356,24 +1416,22 @@ void UpdateCheatRelatedWindow()
// ram search
extern HWND RamSearchHWnd;
if (RamSearchHWnd)
{
// if ram search is open then update the ram list.
SendDlgItemMessage(RamSearchHWnd, IDC_RAMLIST, LVM_REDRAWITEMS,
SendDlgItemMessage(RamSearchHWnd, IDC_RAMLIST, LVM_GETTOPINDEX, 0, 0),
SendDlgItemMessage(RamSearchHWnd, IDC_RAMLIST, LVM_GETTOPINDEX, 0, 0) +
SendDlgItemMessage(RamSearchHWnd, IDC_RAMLIST, LVM_GETCOUNTPERPAGE, 0, 0) + 1);
}
// ram watch
extern void UpdateWatchCheats();
UpdateWatchCheats();
extern HWND RamWatchHWnd;
if (RamWatchHWnd)
{
// if ram watch is open then update the ram list.
SendDlgItemMessage(RamWatchHWnd, IDC_WATCHLIST, LVM_REDRAWITEMS,
SendDlgItemMessage(RamWatchHWnd, IDC_WATCHLIST, LVM_GETTOPINDEX, 0, 0),
SendDlgItemMessage(RamSearchHWnd, IDC_RAMLIST, LVM_GETTOPINDEX, 0, 0) +
SendDlgItemMessage(RamWatchHWnd, IDC_WATCHLIST, LVM_GETCOUNTPERPAGE, 0, 0) + 1);
}
}
@ -1483,4 +1541,20 @@ void DeleteCheatFont()
hFont = NULL;
hNewFont = NULL;
}
}
}
void CreateCheatMap()
{
if (!CheatMapUsers)
FCEUI_CreateCheatMap();
++CheatMapUsers;
}
void ReleaseCheatMap()
{
--CheatMapUsers;
// printf("CheatMapUsers: %d\n", CheatMapUsers);
if (!CheatMapUsers)
FCEUI_ReleaseCheatMap();
}

View File

@ -19,11 +19,13 @@ void UpdateCheatListGroupBoxUI();
void UpdateCheatsAdded();
void ToggleCheatInputMode(HWND hwndDlg, int modeId);
void GetUICheatInfo(HWND hwndDlg, char* name, uint32* a, uint8* v, int* c);
void GetUIGGInfo(HWND hwndDlg, uint32* a, uint8* v, int* c);
inline void GetCheatStr(char* buf, int a, int v, int c);
inline void GetCheatCodeStr(char* buf, int a, int v, int c);
static void SetCheatToolTip(HWND hwndDlg, UINT id);
char* GetCheatToolTipStr(HWND hwndDlg, UINT id);
extern unsigned int FrozenAddressCount;
extern std::vector<uint16> FrozenAddresses;
//void ConfigAddCheat(HWND wnd); //bbit edited:commented out this line
extern struct CHEATF* cheats;
extern char* GameGenieLetters;
@ -38,6 +40,10 @@ void SetupCheatFont(HWND hDlg);
void DeleteCheatFont();
extern POINT CalcSubWindowPos(HWND hDlg, POINT* conf);
void CreateCheatMap();
void ReleaseCheatMap();
extern int CheatMapUsers;
extern INT_PTR CALLBACK GGConvCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
extern LRESULT APIENTRY FilterEditCtrlProc(HWND hDlg, UINT msg, WPARAM wP, LPARAM lP);
extern WNDPROC DefaultEditCtrlProc;

View File

@ -371,13 +371,13 @@ INT_PTR CALLBACK AddbpCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
break;
}
if ((tmp=AddBreak(hwndDlg)) == TOO_MANY_BREAKPOINTS) {
MessageBox(hwndDlg, "Too many breakpoints, please delete one and try again", "Breakpoint Error", MB_OK);
MessageBox(hwndDlg, "Too many breakpoints, please delete one and try again", "Breakpoint Error", MB_OK | MB_ICONERROR);
goto endaddbrk;
}
if (tmp == 2) goto endaddbrk;
else if (tmp == INVALID_BREAKPOINT_CONDITION)
{
MessageBox(hwndDlg, "Invalid breakpoint condition", "Error", MB_OK);
MessageBox(hwndDlg, "Invalid breakpoint condition", "Error", MB_OK | MB_ICONERROR);
break;
}
EndDialog(hwndDlg,1);
@ -1296,7 +1296,7 @@ INT_PTR CALLBACK AssemblerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
saved = 1;
applied = 0;
}
else MessageBox(hwndDlg, "Unable to save changes to file", "Error saving to file", MB_OK);
else MessageBox(hwndDlg, "Unable to save changes to file", "Error saving to file", MB_OK | MB_ICONERROR);
}
}
break;
@ -1335,7 +1335,7 @@ INT_PTR CALLBACK AssemblerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
count += opsize[patchdata[i][0]];
}
if (count > 0x10000) { //note: don't use 0xFFFF!
MessageBox(hwndDlg, "Patch data cannot exceed address 0xFFFF", "Address error", MB_OK);
MessageBox(hwndDlg, "Patch data cannot exceed address 0xFFFF", "Address error", MB_OK | MB_ICONERROR);
break;
}
SetDlgItemText(hwndDlg,IDC_ASSEMBLER_HISTORY,"");
@ -1400,11 +1400,11 @@ INT_PTR CALLBACK PatcherCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
else
iapoffset = GetNesFileAddress(GetEditHex(hwndDlg,IDC_ROMPATCHER_OFFSET));
if((iapoffset < 16) && (iapoffset != -1)){
MessageBox(hDebug, "Sorry, iNes Header editing isn't supported", "Error", MB_OK);
MessageBox(hDebug, "Sorry, iNES Header editing isn't supported by this tool. If you want to edit the header, please use iNES Header Editor", "Error", MB_OK | MB_ICONASTERISK);
iapoffset = -1;
}
if((iapoffset > PRGsize[0]) && (iapoffset != -1)){
MessageBox(hDebug, "Error: .Nes offset outside of PRG rom", "Error", MB_OK);
MessageBox(hDebug, "Error: .Nes offset outside of PRG rom", "Error", MB_OK | MB_ICONERROR);
iapoffset = -1;
}
UpdatePatcher(hwndDlg);
@ -1421,7 +1421,7 @@ INT_PTR CALLBACK PatcherCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
break;
case IDC_ROMPATCHER_BTN_SAVE:
if (!iNesSave())
MessageBox(NULL, "Error Saving", "Error", MB_OK);
MessageBox(NULL, "Error Saving", "Error", MB_OK | MB_ICONERROR);
break;
}
break;
@ -2450,7 +2450,7 @@ void DoPatcher(int address, HWND hParent)
if (GameInterface == iNESGI)
DialogBox(fceu_hInstance, "ROMPATCHER", hParent, PatcherCallB);
else
MessageBox(hDebug, "Sorry, The Patcher only works on INES rom images", "Error", MB_OK);
MessageBox(hDebug, "Sorry, The Patcher only works on INES rom images", "Error", MB_OK | MB_ICONASTERISK);
UpdateDebugger(false);
}

View File

@ -27,7 +27,7 @@ void CloseDirectoriesDialog(HWND hwndDlg)
for(unsigned int curr_dir = 0; curr_dir < NUMBER_OF_DIRECTORIES; curr_dir++)
{
LONG len;
len = SendDlgItemMessage(hwndDlg, EDIT_ROMS + curr_dir, WM_GETTEXTLENGTH, 0, 0);
len = SendDlgItemMessage(hwndDlg, edit_id[curr_dir], WM_GETTEXTLENGTH, 0, 0);
if(len <= 0)
{
@ -47,7 +47,7 @@ void CloseDirectoriesDialog(HWND hwndDlg)
continue;
}
if(!GetDlgItemText(hwndDlg, EDIT_ROMS + curr_dir, directory_names[curr_dir], len))
if(!GetDlgItemText(hwndDlg, edit_id[curr_dir], directory_names[curr_dir], len))
{
free(directory_names[curr_dir]);
directory_names[curr_dir] = 0;
@ -98,7 +98,7 @@ static INT_PTR CALLBACK DirConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
// Initialize the directories textboxes
for(unsigned int curr_dir = 0; curr_dir < NUMBER_OF_DIRECTORIES; curr_dir++)
{
SetDlgItemText(hwndDlg, EDIT_ROMS + curr_dir, directory_names[curr_dir]);
SetDlgItemText(hwndDlg, edit_id[curr_dir], directory_names[curr_dir]);
}
// Check the screenshot naming checkbox if necessary
@ -119,48 +119,54 @@ static INT_PTR CALLBACK DirConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
break;
case WM_COMMAND:
if( !(wParam >> 16) )
switch (HIWORD(wParam))
{
if( (wParam & 0xFFFF) >= BUTTON_ROMS && (wParam & 0xFFFF) <= BUTTON_ROMS + NUMBER_OF_DIRECTORIES)
{
// If a directory selection button was pressed, ask the
// user for a directory.
static char *helpert[14] = {
"Roms",
"Battery Saves",
"Save States",
"FDS Bios Rom",
"Screenshots",
"Cheats",
"Movies",
"Memory Watch",
"Basic Bot",
"Macro files",
"Input Presets",
"Lua Scripts",
"Avi Directory",
"Base Directory",
};
char name[MAX_PATH];
char path[MAX_PATH];
GetDlgItemText(hwndDlg, EDIT_ROMS + ((wParam & 0xFFFF) - BUTTON_ROMS), path, MAX_PATH);
if(BrowseForFolder(hwndDlg, helpert[ ( (wParam & 0xFFFF) - BUTTON_ROMS)], name, path))
case BN_CLICKED:
switch(LOWORD(wParam))
{
SetDlgItemText(hwndDlg, EDIT_ROMS + ((wParam & 0xFFFF) - BUTTON_ROMS), name);
case CLOSE_BUTTON:
CloseDirectoriesDialog(hwndDlg);
break;
case BTN_CANCEL:
EndDialog(hwndDlg, 0);
break;
default:
static char *helpert[14] = {
"Roms",
"Battery Saves",
"Save States",
"FDS Bios Rom",
"Screenshots",
"Cheats",
"Movies",
"Memory Watch",
"Basic Bot",
"Macro files",
"Input Presets",
"Lua Scripts",
"Avi output",
"Base",
};
for (int i = 0; i < NUMBER_OF_DIRECTORIES; ++i)
{
if (browse_btn_id[i] == LOWORD(wParam))
{
// If a directory selection button was pressed, ask the
// user for a directory.
char name[MAX_PATH];
char path[MAX_PATH];
char caption[256];
GetDlgItemText(hwndDlg, edit_id[i], path, MAX_PATH);
sprintf(caption, "Select a directory for %s.", helpert[i]);
if (BrowseForFolder(hwndDlg, caption, name, path))
SetDlgItemText(hwndDlg, edit_id[i], name);
break;
}
}
}
}
else switch(wParam & 0xFFFF)
{
case CLOSE_BUTTON:
CloseDirectoriesDialog(hwndDlg);
break;
case BTN_CANCEL:
EndDialog(hwndDlg, 0);
break;
}
}
}

View File

@ -985,8 +985,11 @@ bool WriteHeaderData(HWND hwnd, iNES_HEADER* header)
sprintf(buf, "PRG ROM size you entered is invalid in iNES 2.0, do you want to set to its nearest value %s?", buf2);
if (MessageBox(hwnd, buf, "Error", MB_YESNO | MB_ICONERROR) == IDYES)
SetDlgItemText(hwnd, IDC_PRGROM_COMBO, buf2);
SetFocus(GetDlgItem(hwnd, IDC_PRGROM_COMBO));
return false;
else
{
SetFocus(GetDlgItem(hwnd, IDC_PRGROM_COMBO));
return false;
}
}
}
else {
@ -1154,8 +1157,11 @@ bool WriteHeaderData(HWND hwnd, iNES_HEADER* header)
sprintf(buf, "CHR ROM size you entered is invalid in iNES 2.0, do you want to set to its nearest value %s?", buf2);
if (MessageBox(hwnd, buf, "Error", MB_YESNO | MB_ICONERROR) == IDYES)
SetDlgItemText(hwnd, IDC_CHRROM_COMBO, buf2);
SetFocus(GetDlgItem(hwnd, IDC_CHRROM_COMBO));
return false;
else
{
SetFocus(GetDlgItem(hwnd, IDC_CHRROM_COMBO));
return false;
}
}
}
else {
@ -1344,14 +1350,14 @@ bool WriteHeaderData(HWND hwnd, iNES_HEADER* header)
int misc_roms = 0;
if (sscanf(buf, "%d", &misc_roms) < 1)
{
MessageBox(hwnd, "Invalid miscellanous ROM(s) count. If you don't know what value should be, we recommend to set it to 0.", "ERROR", MB_OK | MB_ICONERROR);
SetFocus(GetDlgItem(hwnd, IDC_MISCELLANEOUS_ROMS_TEXT));
MessageBox(hwnd, "Invalid miscellanous ROM(s) count. If you don't know what value should be, we recommend to set it to 0.", "Error", MB_OK | MB_ICONERROR);
SetFocus(GetDlgItem(hwnd, IDC_MISCELLANEOUS_ROMS_EDIT));
return false;
}
if (misc_roms > 3)
{
MessageBox(hwnd, "Miscellanous ROM(s) count has exceeded the limit of iNES 2.0 (3)", "Error", MB_OK | MB_ICONERROR);
SetFocus(GetDlgItem(hwnd, IDC_MISCELLANEOUS_ROMS_TEXT));
SetFocus(GetDlgItem(hwnd, IDC_MISCELLANEOUS_ROMS_EDIT));
return false;
}
_header.reserved[0] |= misc_roms & 3;

View File

@ -161,8 +161,10 @@ int PauseAfterLoad;
unsigned int skippy = 0; //Frame skip
int frameSkipCounter = 0; //Counter for managing frame skip
// Contains the names of the overridden standard directories
// in the order roms, nonvol, states, fdsrom, snaps, cheats, movies, memwatch, macro, input presets, lua scripts, base
// in the order roms, nonvol, states, fdsrom, snaps, cheats, movies, memwatch, basic bot, macro, input presets, lua scripts, avi, base
char *directory_names[14] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int edit_id[14] = { EDIT_ROM, EDIT_BATTERY, EDIT_STATE, EDIT_FDSBIOS, EDIT_SCREENSHOT, EDIT_CHEAT, EDIT_MOVIE, EDIT_MEMWATCH, EDIT_BOT, EDIT_MACRO, EDIT_PRESET, EDIT_LUA, EDIT_AVI, EDIT_ROOT };
int browse_btn_id[14] = {BUTTON_ROM, BUTTON_BATTERY, BUTTON_STATE, BUTTON_FDSBIOS, BUTTON_SCREENSHOT, BUTTON_CHEAT, BUTTON_MOVIE, BUTTON_MEMWATCH, BUTTON_BOT, BUTTON_MACRO, BUTTON_PRESET, BUTTON_LUA, BUTTON_AVI, BUTTON_ROOT };
std::string cfgFile = "fceux.cfg";
//Handle of the main window.
HWND hAppWnd = 0;

View File

@ -64,6 +64,8 @@ extern int AutoFireOffset;
extern int vmod;
extern char* directory_names[14];
extern int edit_id[14];
extern int browse_btn_id[14];
char *GetRomName(bool force = false); //Checks if rom is loaded, if so, outputs the Rom name with no directory path or file extension
char *GetRomPath(bool force = false); //Checks if rom is loaded, if so, outputs the Rom path only

View File

@ -669,37 +669,30 @@ void UpdateCaption()
int GetMemViewData(uint32 i)
{
if (EditingMode == MODE_NES_MEMORY)
return GetMem(i);
if (EditingMode == MODE_NES_PPU)
switch (EditingMode)
{
i &= 0x3FFF;
if(i < 0x2000)return VPage[(i)>>10][(i)];
//NSF PPU Viewer crash here (UGETAB) (Also disabled by 'MaxSize = 0x2000')
if (GameInfo->type==GIT_NSF)
{
return (0);
}
else
{
if(i < 0x3F00)
return vnapage[(i >> 10) & 0x3][i & 0x3FF];
return READPAL_MOTHEROFALL(i & 0x1F);
}
}
if (EditingMode == MODE_NES_OAM)
{
return SPRAM[i & 0xFF];
}
if (EditingMode == MODE_NES_FILE)
{
//todo: use getfiledata() here
if(i < 16) return *((unsigned char *)&head+i);
if(i < 16+PRGsize[0])return PRGptr[0][i-16];
if(i < 16+PRGsize[0]+CHRsize[0])return CHRptr[0][i-16-PRGsize[0]];
case MODE_NES_MEMORY:
return GetMem(i);
case MODE_NES_PPU:
i &= 0x3FFF;
if (i < 0x2000)return VPage[(i) >> 10][(i)];
//NSF PPU Viewer crash here (UGETAB) (Also disabled by 'MaxSize = 0x2000')
if (GameInfo->type == GIT_NSF)
return (0);
else
{
if (i < 0x3F00)
return vnapage[(i >> 10) & 0x3][i & 0x3FF];
return READPAL_MOTHEROFALL(i & 0x1F);
}
break;
case MODE_NES_OAM:
return SPRAM[i & 0xFF];
case MODE_NES_FILE:
//todo: use getfiledata() here
if (i < 16) return *((unsigned char *)&head + i);
if (i < 16 + PRGsize[0])return PRGptr[0][i - 16];
if (i < 16 + PRGsize[0] + CHRsize[0])return CHRptr[0][i - 16 - PRGsize[0]];
}
return 0;
}
@ -729,89 +722,88 @@ void UpdateColorTable()
TextColorList[hexBookmarks[j].address - CurOffset] = RGB(0,0xCC,0); // Green for Bookmarks
}
//mbg merge 6/29/06 - added argument
if (EditingMode == MODE_NES_MEMORY)
FCEUI_ListCheats(UpdateCheatColorCallB, 0);
if(EditingMode == MODE_NES_FILE)
switch (EditingMode)
{
if (cdloggerdataSize)
{
for (i = 0; i < DataAmount; i++)
case MODE_NES_MEMORY:
for (uint32 a = CurOffset; a < CurOffset + DataAmount; ++a)
if (FCEUI_FindCheatMapByte(a))
TextColorList[a - CurOffset] = RGB(HexFreezeColorR, HexFreezeColorG, HexFreezeColorB);
break;
case MODE_NES_FILE:
if (cdloggerdataSize)
{
temp_offset = CurOffset + i - 16; // (minus iNES header)
if (temp_offset >= 0)
for (i = 0; i < DataAmount; i++)
{
if ((unsigned int)temp_offset < cdloggerdataSize)
temp_offset = CurOffset + i - 16; // (minus iNES header)
if (temp_offset >= 0)
{
// PRG
if ((cdloggerdata[temp_offset] & 3) == 3)
if ((unsigned int)temp_offset < cdloggerdataSize)
{
// the byte is both Code and Data - green
TextColorList[i]=RGB(0,190,0);
} else if((cdloggerdata[temp_offset] & 3) == 1)
{
// the byte is Code - dark-yellow
TextColorList[i]=RGB(160,140,0);
} else if((cdloggerdata[temp_offset] & 3) == 2)
{
// the byte is Data - blue/cyan
if (cdloggerdata[temp_offset] & 0x40)
// PCM data - cyan
TextColorList[i]=RGB(0,130,160);
else
// non-PCM data - blue
TextColorList[i]=RGB(0,0,210);
// PRG
if ((cdloggerdata[temp_offset] & 3) == 3)
{
// the byte is both Code and Data - green
TextColorList[i] = RGB(0, 190, 0);
}
else if ((cdloggerdata[temp_offset] & 3) == 1)
{
// the byte is Code - dark-yellow
TextColorList[i] = RGB(160, 140, 0);
}
else if ((cdloggerdata[temp_offset] & 3) == 2)
{
// the byte is Data - blue/cyan
if (cdloggerdata[temp_offset] & 0x40)
// PCM data - cyan
TextColorList[i] = RGB(0, 130, 160);
else
// non-PCM data - blue
TextColorList[i] = RGB(0, 0, 210);
}
}
} else
{
temp_offset -= cdloggerdataSize;
if (((unsigned int)temp_offset < cdloggerVideoDataSize))
else
{
// CHR
if ((cdloggervdata[temp_offset] & 3) == 3)
temp_offset -= cdloggerdataSize;
if (((unsigned int)temp_offset < cdloggerVideoDataSize))
{
// the byte was both rendered and read programmatically - light-green
TextColorList[i]=RGB(5,255,5);
} else if ((cdloggervdata[temp_offset] & 3) == 1)
{
// the byte was rendered - yellow
TextColorList[i]=RGB(210,190,0);
} else if ((cdloggervdata[temp_offset] & 3) == 2)
{
// the byte was read programmatically - light-blue
TextColorList[i]=RGB(15,15,255);
// CHR
if ((cdloggervdata[temp_offset] & 3) == 3)
{
// the byte was both rendered and read programmatically - light-green
TextColorList[i] = RGB(5, 255, 5);
}
else if ((cdloggervdata[temp_offset] & 3) == 1)
{
// the byte was rendered - yellow
TextColorList[i] = RGB(210, 190, 0);
}
else if ((cdloggervdata[temp_offset] & 3) == 2)
{
// the byte was read programmatically - light-blue
TextColorList[i] = RGB(15, 15, 255);
}
}
}
}
}
}
}
tmp = undo_list;
while(tmp!= 0)
{
//if((tmp->addr < CurOffset+DataAmount) && (tmp->addr+tmp->size > CurOffset))
for(i = tmp->addr;i < tmp->addr+tmp->size;i++){
if((i > CurOffset) && (i < CurOffset+DataAmount))
TextColorList[i-CurOffset] = RGB(RomFreezeColorR,RomFreezeColorG,RomFreezeColorB);
tmp = undo_list;
while (tmp != 0)
{
//if((tmp->addr < CurOffset+DataAmount) && (tmp->addr+tmp->size > CurOffset))
for (i = tmp->addr; i < tmp->addr + tmp->size; i++) {
if ((i > CurOffset) && (i < CurOffset + DataAmount))
TextColorList[i - CurOffset] = RGB(RomFreezeColorR, RomFreezeColorG, RomFreezeColorB);
}
tmp = tmp->last;
}
tmp=tmp->last;
}
break;
}
UpdateMemoryView(1); //anytime the colors change, the memory viewer needs to be completely redrawn
}
//mbg merge 6/29/06 - added argument
int UpdateCheatColorCallB(char *name, uint32 a, uint8 v, int compare,int s,int type, void *data) {
if((a >= (uint32)CurOffset) && (a < (uint32)CurOffset+DataAmount)){
if(s)TextColorList[a-CurOffset] = RGB(HexFreezeColorR,HexFreezeColorG,HexFreezeColorB);
}
return 1;
}
int addrtodelete; // This is a very ugly hackish method of doing this
int cheatwasdeleted; // but it works and that is all that matters here.
int DeleteCheatCallB(char *name, uint32 a, uint8 v, int compare,int s,int type, void *data){ //mbg merge 6/29/06 - added arg
@ -1001,29 +993,30 @@ void InputData(char *input){
if (addr >= MaxSize) continue;
if (EditingMode == MODE_NES_MEMORY)
switch(EditingMode)
{
// RAM (system bus)
BWrite[addr](addr,data[i]);
} else if (EditingMode == MODE_NES_PPU)
{
// PPU
addr &= 0x3FFF;
if(addr < 0x2000)
VPage[addr>>10][addr] = data[i]; //todo: detect if this is vrom and turn it red if so
if((addr >= 0x2000) && (addr < 0x3F00))
vnapage[(addr>>10)&0x3][addr&0x3FF] = data[i]; //todo: this causes 0x3000-0x3f00 to mirror 0x2000-0x2f00, is this correct?
if((addr >= 0x3F00) && (addr < 0x3FFF))
PalettePoke(addr,data[i]);
} else if (EditingMode == MODE_NES_OAM)
{
addr &= 0xFF;
SPRAM[addr] = data[i];
} else if (EditingMode == MODE_NES_FILE)
{
// ROM
ApplyPatch(addr,datasize,data);
break;
case MODE_NES_MEMORY:
// RAM (system bus)
BWrite[addr](addr, data[i]);
break;
case MODE_NES_PPU:
// PPU
addr &= 0x3FFF;
if (addr < 0x2000)
VPage[addr >> 10][addr] = data[i]; //todo: detect if this is vrom and turn it red if so
if ((addr >= 0x2000) && (addr < 0x3F00))
vnapage[(addr >> 10) & 0x3][addr & 0x3FF] = data[i]; //todo: this causes 0x3000-0x3f00 to mirror 0x2000-0x2f00, is this correct?
if ((addr >= 0x3F00) && (addr < 0x3FFF))
PalettePoke(addr, data[i]);
break;
case MODE_NES_OAM:
addr &= 0xFF;
SPRAM[addr] = data[i];
break;
case MODE_NES_FILE:
// ROM
ApplyPatch(addr, datasize, data);
break;
}
}
CursorStartAddy+=datasize;
@ -1194,6 +1187,8 @@ void KillMemView()
UnregisterClass("MEMVIEW",fceu_hInstance);
hMemView = 0;
hMemFind = 0;
if (EditingMode == MODE_NES_MEMORY)
ReleaseCheatMap();
return;
}
@ -1232,7 +1227,7 @@ LRESULT CALLBACK MemViewCallB(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case WM_CREATE:
SetWindowPos(hwnd,0,MemView_wndx,MemView_wndy,MemViewSizeX,MemViewSizeY,SWP_NOZORDER|SWP_NOOWNERZORDER);
debuggerWasActive = 1;
mDC = GetDC(hwnd);
HDataDC = mDC;//deleteme
@ -1252,6 +1247,7 @@ LRESULT CALLBACK MemViewCallB(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
resetHighlightingActivityLog();
EditingText = CurOffset = 0;
EditingMode = MODE_NES_MEMORY;
CreateCheatMap();
//set the default table
UnloadTableFile();
@ -1685,8 +1681,10 @@ LRESULT CALLBACK MemViewCallB(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
checkCondition(condition, numWPs);
numWPs++;
{ extern int myNumWPs;
myNumWPs++; }
{
extern int myNumWPs;
myNumWPs++;
}
if (hDebug)
AddBreakList();
else
@ -2034,24 +2032,34 @@ LRESULT CALLBACK MemViewCallB(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case MENU_MV_VIEW_PPU:
case MENU_MV_VIEW_OAM:
case MENU_MV_VIEW_ROM:
EditingMode = wParam - MENU_MV_VIEW_RAM;
{
int _EditingMode = wParam - MENU_MV_VIEW_RAM;
// Leave NES Memory
if (_EditingMode == MODE_NES_MEMORY && EditingMode != MODE_NES_MEMORY)
CreateCheatMap();
// Enter NES Memory
if (_EditingMode != MODE_NES_MEMORY && EditingMode == MODE_NES_MEMORY)
ReleaseCheatMap();
EditingMode = _EditingMode;
for (i = MODE_NES_MEMORY; i <= MODE_NES_FILE; i++)
if(EditingMode == i)
{
CheckMenuRadioItem(GetMenu(hMemView), MENU_MV_VIEW_RAM, MENU_MV_VIEW_ROM, MENU_MV_VIEW_RAM + i, MF_BYCOMMAND);
break;
}
if (EditingMode == MODE_NES_MEMORY)
MaxSize = 0x10000;
if (EditingMode == MODE_NES_PPU)
switch (EditingMode)
{
if (GameInfo->type==GIT_NSF) {MaxSize = 0x2000;} //Also disabled under GetMemViewData
else {MaxSize = 0x4000;}
case MODE_NES_MEMORY:
MaxSize = 0x10000; break;
case MODE_NES_PPU:
MaxSize = (GameInfo->type == GIT_NSF ? 0x2000 : 0x4000); break;
case MODE_NES_OAM:
MaxSize = 0x100; break;
case MODE_NES_FILE: //todo: add trainer size
MaxSize = 16 + CHRsize[0] + PRGsize[0]; break;
}
if (EditingMode == MODE_NES_OAM)
MaxSize = 0x100;
if (EditingMode == MODE_NES_FILE)
MaxSize = 16+CHRsize[0]+PRGsize[0]; //todo: add trainer size
if (CurOffset >= MaxSize - DataAmount) CurOffset = MaxSize - DataAmount;
if (CurOffset < 0) CurOffset = 0;
if(CursorEndAddy >= MaxSize) CursorEndAddy = -1;
@ -2070,7 +2078,7 @@ LRESULT CALLBACK MemViewCallB(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
UpdateColorTable();
UpdateCaption();
return 0;
}
case ID_HIGHLIGHTING_HIGHLIGHT_ACTIVITY:
{
MemView_HighlightActivity ^= 1;

View File

@ -315,17 +315,13 @@ void UpdateMemWatch()
MWRec& mwrec = mwrecs[i];
//Display blue if address is frozen
if (FrozenAddressCount && FrozenAddresses.size())
{
if (FrozenAddressCount)
for (unsigned int x = 0; x < FrozenAddressCount; x++)
{
if (mwrec.addr == FrozenAddresses[x])
{
//SetTextColor(hdc,RGB(0,0,255));
extern int FCEUI_FindCheatMapByte(uint16);
if (FCEUI_FindCheatMapByte(mwrec.addr))
SetTextColor(hdc,GetSysColor(COLOR_HIGHLIGHT));
}
}
}
char* text;
if(mwrec.valid && GameInfo)
@ -816,6 +812,8 @@ static INT_PTR CALLBACK MemWatchCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
editlast[x]= 0;
}
CreateCheatMap();
RamChangeInitialize = true;
break;
@ -834,7 +832,9 @@ static INT_PTR CALLBACK MemWatchCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
case WM_QUIT:
CloseMemoryWatch();
break;
case WM_DESTROY:
ReleaseCheatMap();
break;
case WM_DROPFILES:
{
unsigned int len;

View File

@ -39,6 +39,7 @@
#include <commctrl.h>
#include <list>
#include <vector>
#ifdef WIN32
#include "BaseTsd.h"
typedef INT_PTR intptr_t;
@ -641,6 +642,18 @@ unsigned int HardwareAddressToItemIndex(HWAddressType hardwareAddress)
: functionName<char, type>(p0, p1, p2, p3)) \
: functionName<char, type>(p0, p1, p2, p3))
#define CONV_VAL_TO_STR(sizeTypeID, type, val, buf) (sprintf(buf, type == 's' ? "%d" : type == 'u' ? "%u" : type == 'd' ? "%08X" : type == 'w' ? "%04X" : "%02X", sizeTypeID == 'd' ? (type == 's' ? (long)(val & 0xFFFFFFFF) : (unsigned long)(val & 0xFFFFFFFF)) : sizeTypeID == 'w' ? (type == 's' ? (short)(val & 0xFFFF) : (unsigned short)(val & 0xFFFF)) : (type == 's' ? (char)(val & 0xFF) : (unsigned char)(val & 0xFF))), buf)
#define ConvEditTextNum(hDlg, id, sizeTypeID, type) \
{ \
BOOL success = FALSE; \
int val = ReadControlInt(id, type == 'h', success); \
if (success) \
{ \
char num[11]; \
SetDlgItemText(hDlg, id, CONV_VAL_TO_STR(sizeTypeID, type, val, num)); \
} else SetDlgItemText(hDlg, id, ""); \
}
// basic comparison functions:
template <typename T> inline bool LessCmp (T x, T y, T i) { return x < y; }
template <typename T> inline bool MoreCmp (T x, T y, T i) { return x > y; }
@ -1250,20 +1263,20 @@ LRESULT CustomDraw (LPARAM lParam)
int rv = CDRF_DODEFAULT;
int cheat = CALL_WITH_T_SIZE_TYPES_1(GetNumCheatsFromIndex, rs_type_size, rs_t == 's', noMisalign, lplvcd->nmcd.dwItemSpec);
switch (cheat) {
default:
case 0:
if (lplvcd->nmcd.dwItemSpec % 2)
lplvcd->clrTextBk = RGB(248, 248, 255);
break;
case 1:
lplvcd->clrTextBk = RGB(216, 203, 253); break;
case 2:
lplvcd->clrTextBk = RGB(195, 186, 253); break;
case 3:
lplvcd->clrTextBk = RGB(176, 139, 252); break;
case 4:
lplvcd->clrTextBk = RGB(175, 94, 253);
lplvcd->clrText = RGB(255, 255, 255); break; // use a more visual color in dark background
default:
case 0:
if (lplvcd->nmcd.dwItemSpec % 2)
lplvcd->clrTextBk = RGB(248, 248, 255);
break;
case 1:
lplvcd->clrTextBk = CHEAT_1BYTE_BG; break;
case 2:
lplvcd->clrTextBk = CHEAT_2BYTE_BG; break;
case 3:
lplvcd->clrTextBk = CHEAT_3BYTE_BG; break;
case 4:
lplvcd->clrTextBk = CHEAT_4BYTE_BG;
lplvcd->clrText = CHEAT_4BYTE_TEXT; break; // use a more visual color in dark background
}
if(!IsSatisfied(lplvcd->nmcd.dwItemSpec))
@ -1401,11 +1414,14 @@ INT_PTR CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
static int watchIndex=0;
switch(uMsg)
{
case WM_INITDIALOG: {
case WM_INITDIALOG:
{
RamSearchHWnd = hDlg;
CalcSubWindowPos(hDlg, NULL);
CreateCheatMap();
switch(rs_o)
{
case '<':
@ -1435,6 +1451,7 @@ INT_PTR CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
EnableWindow(GetDlgItem(hDlg,IDC_EDIT_MODBY),true);
break;
}
switch (rs_c)
{
case 'r':
@ -1453,6 +1470,7 @@ INT_PTR CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
EnableWindow(GetDlgItem(hDlg,IDC_EDIT_COMPARECHANGES),true);
break;
}
switch (rs_t)
{
case 's':
@ -1465,6 +1483,7 @@ INT_PTR CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
SendDlgItemMessage(hDlg, IDC_HEX, BM_SETCHECK, BST_CHECKED, 0);
break;
}
switch (rs_type_size)
{
case 'b':
@ -1517,8 +1536,16 @@ INT_PTR CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
ListView_SetCallbackMask(GetDlgItem(hDlg,IDC_RAMLIST), LVIS_FOCUSED|LVIS_SELECTED);
SendDlgItemMessage(hDlg, IDC_EDIT_COMPAREADDRESS, EM_SETLIMITTEXT, 4, 0);
DefaultEditCtrlProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hDlg, IDC_EDIT_DIFFBY), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
SetWindowLongPtr(GetDlgItem(hDlg, IDC_EDIT_MODBY), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
SetWindowLongPtr(GetDlgItem(hDlg, IDC_EDIT_COMPAREVALUE), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
SetWindowLongPtr(GetDlgItem(hDlg, IDC_EDIT_COMPAREADDRESS), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
return true;
} break;
}
break;
case WM_NOTIFY:
{
LPNMHDR lP = (LPNMHDR) lParam;
@ -1561,28 +1588,12 @@ INT_PTR CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
case 1:
{
int i = CALL_WITH_T_SIZE_TYPES_1(GetCurValueFromItemIndex, rs_type_size,rs_t=='s',noMisalign, iNum);
const char* formatString = ((rs_t=='s') ? "%d" : (rs_t=='u') ? "%u" : (rs_type_size=='d' ? "%08X" : rs_type_size=='w' ? "%04X" : "%02X"));
switch (rs_type_size)
{
case 'b':
default: sprintf(num, formatString, rs_t=='s' ? (char)(i&0xff) : (unsigned char)(i&0xff)); break;
case 'w': sprintf(num, formatString, rs_t=='s' ? (short)(i&0xffff) : (unsigned short)(i&0xffff)); break;
case 'd': sprintf(num, formatString, rs_t=='s' ? (long)(i&0xffffffff) : (unsigned long)(i&0xffffffff)); break;
}
Item->item.pszText = num;
Item->item.pszText = CONV_VAL_TO_STR(rs_type_size, rs_t, i, num);
} return true;
case 2:
{
int i = CALL_WITH_T_SIZE_TYPES_1(GetPrevValueFromItemIndex, rs_type_size,rs_t=='s',noMisalign, iNum);
const char* formatString = ((rs_t=='s') ? "%d" : (rs_t=='u') ? "%u" : (rs_type_size=='d' ? "%08X" : rs_type_size=='w' ? "%04X" : "%02X"));
switch (rs_type_size)
{
case 'b':
default: sprintf(num, formatString, rs_t=='s' ? (char)(i&0xff) : (unsigned char)(i&0xff)); break;
case 'w': sprintf(num, formatString, rs_t=='s' ? (short)(i&0xffff) : (unsigned short)(i&0xffff)); break;
case 'd': sprintf(num, formatString, rs_t=='s' ? (long)(i&0xffffffff) : (unsigned long)(i&0xffffffff)); break;
}
Item->item.pszText = num;
Item->item.pszText = CONV_VAL_TO_STR(rs_type_size, rs_t, i, num);
} return true;
case 3:
{
@ -1646,420 +1657,455 @@ INT_PTR CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
// return 0;
//}
}
break;
}
break;
case WM_COMMAND:
{
int rv = false;
switch(LOWORD(wParam))
switch (HIWORD(wParam))
{
case IDC_SIGNED:
rs_t='s';
signal_new_size();
{rv = true; break;}
case IDC_UNSIGNED:
rs_t='u';
signal_new_size();
{rv = true; break;}
case IDC_HEX:
rs_t='h';
signal_new_size();
{rv = true; break;}
case IDC_1_BYTE:
rs_type_size = 'b';
signal_new_size();
{rv = true; break;}
case IDC_2_BYTES:
rs_type_size = 'w';
signal_new_size();
{rv = true; break;}
case IDC_4_BYTES:
rs_type_size = 'd';
signal_new_size();
{rv = true; break;}
case IDC_MISALIGN:
noMisalign = !noMisalign;
//CompactAddrs();
signal_new_size();
{rv = true; break;}
// case IDC_ENDIAN:
//// littleEndian = !littleEndian;
//// signal_new_size();
// {rv = true; break;}
case IDC_LESSTHAN:
EnableWindow(GetDlgItem(hDlg,IDC_EDIT_DIFFBY),false);
EnableWindow(GetDlgItem(hDlg,IDC_EDIT_MODBY),false);
rs_o = '<';
{rv = true; break;}
case IDC_MORETHAN:
EnableWindow(GetDlgItem(hDlg,IDC_EDIT_DIFFBY),false);
EnableWindow(GetDlgItem(hDlg,IDC_EDIT_MODBY),false);
rs_o = '>';
{rv = true; break;}
case IDC_NOMORETHAN:
EnableWindow(GetDlgItem(hDlg,IDC_EDIT_DIFFBY),false);
EnableWindow(GetDlgItem(hDlg,IDC_EDIT_MODBY),false);
rs_o = 'l';
{rv = true; break;}
case IDC_NOLESSTHAN:
EnableWindow(GetDlgItem(hDlg,IDC_EDIT_DIFFBY),false);
EnableWindow(GetDlgItem(hDlg,IDC_EDIT_MODBY),false);
rs_o = 'm';
{rv = true; break;}
case IDC_EQUALTO:
EnableWindow(GetDlgItem(hDlg,IDC_EDIT_DIFFBY),false);
EnableWindow(GetDlgItem(hDlg,IDC_EDIT_MODBY),false);
rs_o = '=';
{rv = true; break;}
case IDC_DIFFERENTFROM:
EnableWindow(GetDlgItem(hDlg,IDC_EDIT_DIFFBY),false);
EnableWindow(GetDlgItem(hDlg,IDC_EDIT_MODBY),false);
rs_o = '!';
{rv = true; break;}
case IDC_DIFFERENTBY:
case BN_CLICKED:
{
rs_o = 'd';
EnableWindow(GetDlgItem(hDlg,IDC_EDIT_DIFFBY),true);
EnableWindow(GetDlgItem(hDlg,IDC_EDIT_MODBY),false);
if(!SelectingByKeyboard())
SelectEditControl(IDC_EDIT_DIFFBY);
} {rv = true; break;}
case IDC_MODULO:
{
rs_o = '%';
EnableWindow(GetDlgItem(hDlg,IDC_EDIT_DIFFBY),false);
EnableWindow(GetDlgItem(hDlg,IDC_EDIT_MODBY),true);
if(!SelectingByKeyboard())
SelectEditControl(IDC_EDIT_MODBY);
} {rv = true; break;}
case IDC_PREVIOUSVALUE:
rs_c='r';
EnableWindow(GetDlgItem(hDlg,IDC_EDIT_COMPAREVALUE),false);
EnableWindow(GetDlgItem(hDlg,IDC_EDIT_COMPAREADDRESS),false);
EnableWindow(GetDlgItem(hDlg,IDC_EDIT_COMPARECHANGES),false);
{rv = true; break;}
case IDC_SPECIFICVALUE:
{
rs_c = 's';
EnableWindow(GetDlgItem(hDlg,IDC_EDIT_COMPAREVALUE),true);
EnableWindow(GetDlgItem(hDlg,IDC_EDIT_COMPAREADDRESS),false);
EnableWindow(GetDlgItem(hDlg,IDC_EDIT_COMPARECHANGES),false);
if(!SelectingByKeyboard())
SelectEditControl(IDC_EDIT_COMPAREVALUE);
{rv = true; break;}
}
case IDC_SPECIFICADDRESS:
{
rs_c = 'a';
EnableWindow(GetDlgItem(hDlg,IDC_EDIT_COMPAREADDRESS),true);
EnableWindow(GetDlgItem(hDlg,IDC_EDIT_COMPAREVALUE),false);
EnableWindow(GetDlgItem(hDlg,IDC_EDIT_COMPARECHANGES),false);
if(!SelectingByKeyboard())
SelectEditControl(IDC_EDIT_COMPAREADDRESS);
} {rv = true; break;}
case IDC_NUMBEROFCHANGES:
{
rs_c = 'n';
EnableWindow(GetDlgItem(hDlg,IDC_EDIT_COMPARECHANGES),true);
EnableWindow(GetDlgItem(hDlg,IDC_EDIT_COMPAREVALUE),false);
EnableWindow(GetDlgItem(hDlg,IDC_EDIT_COMPAREADDRESS),false);
if(!SelectingByKeyboard())
SelectEditControl(IDC_EDIT_COMPARECHANGES);
} {rv = true; break;}
case IDC_C_ADDCHEAT:
{
HWND ramListControl = GetDlgItem(hDlg,IDC_RAMLIST);
int watchItemIndex = ListView_GetNextItem(ramListControl, -1, LVNI_SELECTED);
while (watchItemIndex >= 0)
int rv = true;
bool needRefresh = true;
switch (LOWORD(wParam))
{
unsigned long address = CALL_WITH_T_SIZE_TYPES_1(GetHardwareAddressFromItemIndex, rs_type_size,rs_t=='s',noMisalign, watchItemIndex);
unsigned long curvalue = CALL_WITH_T_SIZE_TYPES_1(GetCurValueFromItemIndex, rs_type_size,rs_t=='s',noMisalign, watchItemIndex);
int sizeType = -1;
if(rs_type_size == 'b')
sizeType = 0;
else if(rs_type_size == 'w')
sizeType = 1;
else if(rs_type_size == 'd')
sizeType = 2;
int numberType = -1;
if(rs_t == 's')
numberType = 0;
else if(rs_t == 'u')
numberType = 1;
else if(rs_t == 'h')
numberType = 2;
// Don't open cheat dialog
switch (sizeType) {
case 0:
FCEUI_AddCheat("",address,curvalue, -1, 1);
break;
case 1:
FCEUI_AddCheat("",address,curvalue & 0xFF, -1, 1);
FCEUI_AddCheat("",address + 1,(curvalue & 0xFF00) / 0x100, -1, 1);
break;
case 2:
FCEUI_AddCheat("",address,curvalue & 0xFF,-1,1);
FCEUI_AddCheat("",address + 1,(curvalue & 0xFF00) / 0x100, -1, 1);
FCEUI_AddCheat("",address + 2,(curvalue & 0xFF0000) / 0x10000, -1, 1);
FCEUI_AddCheat("",address + 3,(curvalue & 0xFF000000) / 0x1000000, -1, 1);
break;
}
UpdateCheatsAdded();
UpdateCheatRelatedWindow();
watchItemIndex = ListView_GetNextItem(ramListControl, watchItemIndex, LVNI_SELECTED);
}
} {rv = true; break;}
case IDC_C_SEARCHROM:
ShowROM = SendDlgItemMessage(hDlg, IDC_C_SEARCHROM, BM_GETCHECK, 0, 0) != 0;
case IDC_C_RESET:
{
RamSearchSaveUndoStateIfNotTooBig(RamSearchHWnd);
int prevNumItems = last_rs_possible;
soft_reset_address_info();
if(prevNumItems == last_rs_possible)
SetRamSearchUndoType(RamSearchHWnd, 0); // nothing to undo
ListView_SetItemState(GetDlgItem(hDlg,IDC_RAMLIST), -1, 0, LVIS_SELECTED); // deselect all
//ListView_SetItemCount(GetDlgItem(hDlg,IDC_RAMLIST),ResultCount);
ListView_SetSelectionMark(GetDlgItem(hDlg,IDC_RAMLIST), 0);
RefreshRamListSelectedCountControlStatus(hDlg);
Update_RAM_Search();
{rv = true; break;}
}
case IDC_C_RESET_CHANGES:
memset(s_numChanges, 0, (sizeof(*s_numChanges)*(MAX_RAM_SIZE)));
ListView_Update(GetDlgItem(hDlg,IDC_RAMLIST), -1);
Update_RAM_Search();
//SetRamSearchUndoType(hDlg, 0);
{rv = true; break;}
case IDC_C_UNDO:
if(s_undoType>0)
{
// Clear_Sound_Buffer();
EnterCriticalSection(&s_activeMemoryRegionsCS);
if(s_activeMemoryRegions.size() < tooManyRegionsForUndo)
case IDC_SIGNED:
{
MemoryList tempMemoryList = s_activeMemoryRegions;
s_activeMemoryRegions = s_activeMemoryRegionsBackup;
s_activeMemoryRegionsBackup = tempMemoryList;
LeaveCriticalSection(&s_activeMemoryRegionsCS);
SetRamSearchUndoType(hDlg, 3 - s_undoType);
rs_t = 's';
signal_new_size();
ConvEditTextNum(hDlg, IDC_EDIT_COMPAREVALUE, rs_type_size, rs_t);
ConvEditTextNum(hDlg, IDC_EDIT_DIFFBY, rs_type_size, rs_t);
ConvEditTextNum(hDlg, IDC_EDIT_MODBY, rs_type_size, rs_t);
}
else
break;
case IDC_UNSIGNED:
{
s_activeMemoryRegions = s_activeMemoryRegionsBackup;
LeaveCriticalSection(&s_activeMemoryRegionsCS);
SetRamSearchUndoType(hDlg, -1);
rs_t = 'u';
signal_new_size();
ConvEditTextNum(hDlg, IDC_EDIT_COMPAREVALUE, rs_type_size, rs_t);
ConvEditTextNum(hDlg, IDC_EDIT_DIFFBY, rs_type_size, rs_t);
ConvEditTextNum(hDlg, IDC_EDIT_MODBY, rs_type_size, rs_t);
}
CompactAddrs();
ListView_SetItemState(GetDlgItem(hDlg,IDC_RAMLIST), -1, 0, LVIS_SELECTED); // deselect all
ListView_SetSelectionMark(GetDlgItem(hDlg,IDC_RAMLIST), 0);
RefreshRamListSelectedCountControlStatus(hDlg);
}
{rv = true; break;}
case IDC_C_AUTOSEARCH:
AutoSearch = SendDlgItemMessage(hDlg, IDC_C_AUTOSEARCH, BM_GETCHECK, 0, 0) != 0;
AutoSearchAutoRetry = false;
if (!AutoSearch) {rv = true; break;}
case IDC_C_SEARCH:
{
// Clear_Sound_Buffer();
if(!rs_val_valid && !(rs_val_valid = Set_RS_Val()))
goto invalid_field;
if(ResultCount)
{
RamSearchSaveUndoStateIfNotTooBig(hDlg);
prune(rs_c,rs_o,rs_t=='s',rs_val,rs_param);
RefreshRamListSelectedCountControlStatus(hDlg);
}
if(!ResultCount)
{
MessageBox(RamSearchHWnd,"Resetting search.","Out of results.",MB_OK|MB_ICONINFORMATION);
soft_reset_address_info();
}
{rv = true; break;}
invalid_field:
MessageBox(RamSearchHWnd,"Invalid or out-of-bound entered value.","Error",MB_OK|MB_ICONSTOP);
if(AutoSearch) // stop autosearch if it just started
{
SendDlgItemMessage(hDlg, IDC_C_AUTOSEARCH, BM_SETCHECK, BST_UNCHECKED, 0);
SendMessage(hDlg, WM_COMMAND, IDC_C_AUTOSEARCH, 0);
}
{rv = true; break;}
}
case IDC_C_HEXEDITOR:
{
HWND ramListControl = GetDlgItem(hDlg,IDC_RAMLIST);
int selCount = ListView_GetSelectedCount(ramListControl);
int watchItemIndex = ListView_GetNextItem(ramListControl, -1, LVNI_SELECTED);
if (watchItemIndex >= 0)
{
unsigned int addr = CALL_WITH_T_SIZE_TYPES_1(GetHardwareAddressFromItemIndex, rs_type_size, rs_t=='s', noMisalign, watchItemIndex);
ChangeMemViewFocus(0, addr, -1);
}
break;
}
case IDC_C_WATCH:
{
HWND ramListControl = GetDlgItem(hDlg,IDC_RAMLIST);
int selCount = SendMessage(ramListControl, LVM_GETSELECTEDCOUNT, 0, 0);
if (selCount > 0)
{
AddressWatcher tempWatch;
tempWatch.Size = rs_type_size;
tempWatch.Type = rs_t;
tempWatch.WrongEndian = 0; //Replace when I get little endian working
tempWatch.comment = NULL;
bool inserted = false;
AddressWatcher* watches = (AddressWatcher*)malloc(selCount * sizeof(AddressWatcher));
int i = 0;
int watchItemIndex = -1;
while ((watchItemIndex = SendMessage(ramListControl, LVM_GETNEXTITEM, watchItemIndex, LVNI_SELECTED)) >= 0)
break;
case IDC_HEX:
{
tempWatch.Address = CALL_WITH_T_SIZE_TYPES_1(GetHardwareAddressFromItemIndex, rs_type_size, rs_t == 's', noMisalign, watchItemIndex);
watches[i] = tempWatch;
++i;
rs_t = 'h';
signal_new_size();
ConvEditTextNum(hDlg, IDC_EDIT_COMPAREVALUE, rs_type_size, rs_t);
ConvEditTextNum(hDlg, IDC_EDIT_DIFFBY, rs_type_size, rs_t);
ConvEditTextNum(hDlg, IDC_EDIT_MODBY, rs_type_size, rs_t);
}
// bring up the ram watch window if it's not already showing so the user knows where the watch went
if ((selCount == 1 ?
InsertWatch(watches[0], hDlg) : InsertWatches(watches, hDlg, selCount))
&& !RamWatchHWnd)
SendMessage(hWnd, WM_COMMAND, ID_RAM_WATCH, 0);
SetForegroundWindow(RamSearchHWnd);
free(watches);
}
{rv = true; break;}
}
// eliminate all selected items
case IDC_C_ELIMINATE:
{
RamSearchSaveUndoStateIfNotTooBig(hDlg);
HWND ramListControl = GetDlgItem(hDlg,IDC_RAMLIST);
int size = (rs_type_size=='b' || !noMisalign) ? 1 : 2;
int selCount = ListView_GetSelectedCount(ramListControl);
int watchIndex = -1;
// time-saving trick #1:
// condense the selected items into an array of address ranges
std::vector<AddrRange> selHardwareAddrs;
for(int i = 0, j = 1024; i < selCount; ++i, --j)
{
watchIndex = ListView_GetNextItem(ramListControl, watchIndex, LVNI_SELECTED);
int addr = CALL_WITH_T_SIZE_TYPES_1(GetHardwareAddressFromItemIndex, rs_type_size,rs_t=='s',noMisalign, watchIndex);
if(!selHardwareAddrs.empty() && addr == selHardwareAddrs.back().End())
selHardwareAddrs.back().size += size;
else
selHardwareAddrs.push_back(AddrRange(addr,size));
if(!j) UpdateRamSearchProgressBar(i * 50 / selCount), j = 1024;
}
// now deactivate the ranges
// time-saving trick #2:
// take advantage of the fact that the listbox items must be in the same order as the regions
MemoryList::iterator iter = s_activeMemoryRegions.begin();
int numHardwareAddrRanges = selHardwareAddrs.size();
for(int i = 0, j = 16; i < numHardwareAddrRanges; ++i, --j)
{
int addr = selHardwareAddrs[i].addr;
int size = selHardwareAddrs[i].size;
bool affected = false;
while(iter != s_activeMemoryRegions.end())
break;
case IDC_1_BYTE:
{
MemoryRegion& region = *iter;
int affNow = DeactivateRegion(region, iter, addr, size);
if(affNow)
affected = true;
else if(affected)
needRefresh = false;
rs_type_size = 'b';
signal_new_size();
BOOL success = FALSE;
int val = ReadControlInt(IDC_EDIT_COMPAREVALUE, false, success);
if (success)
{
char num[11];
SetDlgItemText(hDlg, IDC_EDIT_COMPAREVALUE, CONV_VAL_TO_STR(rs_type_size, rs_t, val, num));
}
}
break;
case IDC_2_BYTES:
needRefresh = false;
rs_type_size = 'w';
signal_new_size();
break;
case IDC_4_BYTES:
needRefresh = false;
rs_type_size = 'd';
signal_new_size();
break;
case IDC_MISALIGN:
needRefresh = false;
noMisalign = !noMisalign;
//CompactAddrs();
signal_new_size();
break;
// case IDC_ENDIAN:
// littleEndian = !littleEndian;
// signal_new_size();
// break;
case IDC_LESSTHAN:
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_DIFFBY), false);
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_MODBY), false);
rs_o = '<';
break;
case IDC_MORETHAN:
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_DIFFBY), false);
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_MODBY), false);
rs_o = '>';
break;
case IDC_NOMORETHAN:
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_DIFFBY), false);
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_MODBY), false);
rs_o = 'l';
break;
case IDC_NOLESSTHAN:
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_DIFFBY), false);
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_MODBY), false);
rs_o = 'm';
break;
case IDC_EQUALTO:
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_DIFFBY), false);
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_MODBY), false);
rs_o = '=';
break;
case IDC_DIFFERENTFROM:
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_DIFFBY), false);
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_MODBY), false);
rs_o = '!';
break;
case IDC_DIFFERENTBY:
{
rs_o = 'd';
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_DIFFBY), true);
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_MODBY), false);
if (!SelectingByKeyboard())
SelectEditControl(IDC_EDIT_DIFFBY);
break;
}
case IDC_MODULO:
{
rs_o = '%';
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_DIFFBY), false);
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_MODBY), true);
if (!SelectingByKeyboard())
SelectEditControl(IDC_EDIT_MODBY);
break;
}
case IDC_PREVIOUSVALUE:
rs_c = 'r';
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_COMPAREVALUE), false);
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_COMPAREADDRESS), false);
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_COMPARECHANGES), false);
break;
case IDC_SPECIFICVALUE:
{
rs_c = 's';
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_COMPAREVALUE), true);
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_COMPAREADDRESS), false);
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_COMPARECHANGES), false);
if (!SelectingByKeyboard())
SelectEditControl(IDC_EDIT_COMPAREVALUE);
break;
}
case IDC_SPECIFICADDRESS:
{
rs_c = 'a';
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_COMPAREADDRESS), true);
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_COMPAREVALUE), false);
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_COMPARECHANGES), false);
if (!SelectingByKeyboard())
SelectEditControl(IDC_EDIT_COMPAREADDRESS);
break;
}
case IDC_NUMBEROFCHANGES:
{
rs_c = 'n';
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_COMPARECHANGES), true);
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_COMPAREVALUE), false);
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_COMPAREADDRESS), false);
if (!SelectingByKeyboard())
SelectEditControl(IDC_EDIT_COMPARECHANGES);
break;
}
case IDC_C_ADDCHEAT:
{
needRefresh = false;
HWND ramListControl = GetDlgItem(hDlg, IDC_RAMLIST);
int watchItemIndex = ListView_GetNextItem(ramListControl, -1, LVNI_SELECTED);
while (watchItemIndex >= 0)
{
unsigned long address = CALL_WITH_T_SIZE_TYPES_1(GetHardwareAddressFromItemIndex, rs_type_size, rs_t == 's', noMisalign, watchItemIndex);
unsigned long curvalue = CALL_WITH_T_SIZE_TYPES_1(GetCurValueFromItemIndex, rs_type_size, rs_t == 's', noMisalign, watchItemIndex);
int sizeType = -1;
if (rs_type_size == 'b')
sizeType = 0;
else if (rs_type_size == 'w')
sizeType = 1;
else if (rs_type_size == 'd')
sizeType = 2;
int numberType = -1;
if (rs_t == 's')
numberType = 0;
else if (rs_t == 'u')
numberType = 1;
else if (rs_t == 'h')
numberType = 2;
// Don't open cheat dialog
switch (sizeType) {
case 0:
FCEUI_AddCheat("", address, curvalue, -1, 1);
break;
case 1:
FCEUI_AddCheat("", address, curvalue & 0xFF, -1, 1);
FCEUI_AddCheat("", address + 1, (curvalue & 0xFF00) / 0x100, -1, 1);
break;
case 2:
FCEUI_AddCheat("", address, curvalue & 0xFF, -1, 1);
FCEUI_AddCheat("", address + 1, (curvalue & 0xFF00) / 0x100, -1, 1);
FCEUI_AddCheat("", address + 2, (curvalue & 0xFF0000) / 0x10000, -1, 1);
FCEUI_AddCheat("", address + 3, (curvalue & 0xFF000000) / 0x1000000, -1, 1);
break;
}
UpdateCheatsAdded();
UpdateCheatRelatedWindow();
watchItemIndex = ListView_GetNextItem(ramListControl, watchItemIndex, LVNI_SELECTED);
}
break;
}
case IDC_C_SEARCHROM:
ShowROM = SendDlgItemMessage(hDlg, IDC_C_SEARCHROM, BM_GETCHECK, 0, 0) != 0;
case IDC_C_RESET:
{
needRefresh = false;
RamSearchSaveUndoStateIfNotTooBig(RamSearchHWnd);
int prevNumItems = last_rs_possible;
soft_reset_address_info();
if (prevNumItems == last_rs_possible)
SetRamSearchUndoType(RamSearchHWnd, 0); // nothing to undo
ListView_SetItemState(GetDlgItem(hDlg, IDC_RAMLIST), -1, 0, LVIS_SELECTED); // deselect all
//ListView_SetItemCount(GetDlgItem(hDlg,IDC_RAMLIST),ResultCount);
ListView_SetSelectionMark(GetDlgItem(hDlg, IDC_RAMLIST), 0);
RefreshRamListSelectedCountControlStatus(hDlg);
Update_RAM_Search();
break;
}
case IDC_C_RESET_CHANGES:
needRefresh = false;
memset(s_numChanges, 0, (sizeof(*s_numChanges)*(MAX_RAM_SIZE)));
ListView_Update(GetDlgItem(hDlg, IDC_RAMLIST), -1);
Update_RAM_Search();
//SetRamSearchUndoType(hDlg, 0);
break;
case IDC_C_UNDO:
needRefresh = false;
if (s_undoType > 0)
{
// Clear_Sound_Buffer();
EnterCriticalSection(&s_activeMemoryRegionsCS);
if (s_activeMemoryRegions.size() < tooManyRegionsForUndo)
{
MemoryList tempMemoryList = s_activeMemoryRegions;
s_activeMemoryRegions = s_activeMemoryRegionsBackup;
s_activeMemoryRegionsBackup = tempMemoryList;
LeaveCriticalSection(&s_activeMemoryRegionsCS);
SetRamSearchUndoType(hDlg, 3 - s_undoType);
}
else
{
s_activeMemoryRegions = s_activeMemoryRegionsBackup;
LeaveCriticalSection(&s_activeMemoryRegionsCS);
SetRamSearchUndoType(hDlg, -1);
}
CompactAddrs();
ListView_SetItemState(GetDlgItem(hDlg, IDC_RAMLIST), -1, 0, LVIS_SELECTED); // deselect all
ListView_SetSelectionMark(GetDlgItem(hDlg, IDC_RAMLIST), 0);
RefreshRamListSelectedCountControlStatus(hDlg);
}
break;
case IDC_C_AUTOSEARCH:
needRefresh = false;
AutoSearch = SendDlgItemMessage(hDlg, IDC_C_AUTOSEARCH, BM_GETCHECK, 0, 0) != 0;
AutoSearchAutoRetry = false;
if (!AutoSearch)
break;
if(affNow != 2)
++iter;
else
rv = false;
case IDC_C_SEARCH:
{
needRefresh = false;
// Clear_Sound_Buffer();
if (!rs_val_valid && !(rs_val_valid = Set_RS_Val()))
{
MessageBox(RamSearchHWnd, "Invalid or out-of-bound entered value.", "Error", MB_OK | MB_ICONSTOP);
if (AutoSearch) // stop autosearch if it just started
{
SendDlgItemMessage(hDlg, IDC_C_AUTOSEARCH, BM_SETCHECK, BST_UNCHECKED, 0);
SendMessage(hDlg, WM_COMMAND, IDC_C_AUTOSEARCH, 0);
}
}
else {
if (ResultCount)
{
RamSearchSaveUndoStateIfNotTooBig(hDlg);
prune(rs_c, rs_o, rs_t == 's', rs_val, rs_param);
RefreshRamListSelectedCountControlStatus(hDlg);
}
if (!ResultCount)
{
MessageBox(RamSearchHWnd, "Resetting search.", "Out of results.", MB_OK | MB_ICONINFORMATION);
soft_reset_address_info();
}
}
break;
}
case IDC_C_HEXEDITOR:
{
needRefresh = false;
HWND ramListControl = GetDlgItem(hDlg, IDC_RAMLIST);
int selCount = ListView_GetSelectedCount(ramListControl);
int watchItemIndex = ListView_GetNextItem(ramListControl, -1, LVNI_SELECTED);
if (watchItemIndex >= 0)
{
unsigned int addr = CALL_WITH_T_SIZE_TYPES_1(GetHardwareAddressFromItemIndex, rs_type_size, rs_t == 's', noMisalign, watchItemIndex);
ChangeMemViewFocus(0, addr, -1);
}
rv = false;
break;
}
case IDC_C_WATCH:
{
needRefresh = false;
HWND ramListControl = GetDlgItem(hDlg, IDC_RAMLIST);
int selCount = SendMessage(ramListControl, LVM_GETSELECTEDCOUNT, 0, 0);
if (selCount > 0)
{
WatcherMsg msg;
msg.Size = rs_type_size;
msg.Type = rs_t;
msg.WrongEndian = 0; //Replace when I get little endian working
msg.comment = NULL;
bool inserted = false;
msg.Addresses = (unsigned int*)malloc(selCount * sizeof(unsigned int));
int i = 0;
int watchItemIndex = -1;
while ((watchItemIndex = SendMessage(ramListControl, LVM_GETNEXTITEM, watchItemIndex, LVNI_SELECTED)) >= 0)
{
msg.Addresses[i] = CALL_WITH_T_SIZE_TYPES_1(GetHardwareAddressFromItemIndex, rs_type_size, rs_t == 's', noMisalign, watchItemIndex);
++i;
}
msg.count = i;
// bring up the ram watch window if it's not already showing so the user knows where the watch went
if (InsertWatches(&msg, hDlg, selCount)
&& !RamWatchHWnd)
SendMessage(hWnd, WM_COMMAND, ID_RAM_WATCH, 0);
SetForegroundWindow(RamSearchHWnd);
if (msg.Addresses) free(msg.Addresses);
if (msg.comment) free(msg.comment);
}
break;
}
if(!j) UpdateRamSearchProgressBar(50 + (i * 50 / selCount)), j = 16;
// eliminate all selected items
case IDC_C_ELIMINATE:
{
needRefresh = false;
RamSearchSaveUndoStateIfNotTooBig(hDlg);
HWND ramListControl = GetDlgItem(hDlg, IDC_RAMLIST);
int size = (rs_type_size == 'b' || !noMisalign) ? 1 : 2;
int selCount = ListView_GetSelectedCount(ramListControl);
int watchIndex = -1;
// time-saving trick #1:
// condense the selected items into an array of address ranges
std::vector<AddrRange> selHardwareAddrs;
for (int i = 0, j = 1024; i < selCount; ++i, --j)
{
watchIndex = ListView_GetNextItem(ramListControl, watchIndex, LVNI_SELECTED);
int addr = CALL_WITH_T_SIZE_TYPES_1(GetHardwareAddressFromItemIndex, rs_type_size, rs_t == 's', noMisalign, watchIndex);
if (!selHardwareAddrs.empty() && addr == selHardwareAddrs.back().End())
selHardwareAddrs.back().size += size;
else
selHardwareAddrs.push_back(AddrRange(addr, size));
if (!j) UpdateRamSearchProgressBar(i * 50 / selCount), j = 1024;
}
// now deactivate the ranges
// time-saving trick #2:
// take advantage of the fact that the listbox items must be in the same order as the regions
MemoryList::iterator iter = s_activeMemoryRegions.begin();
int numHardwareAddrRanges = selHardwareAddrs.size();
for (int i = 0, j = 16; i < numHardwareAddrRanges; ++i, --j)
{
int addr = selHardwareAddrs[i].addr;
int size = selHardwareAddrs[i].size;
bool affected = false;
while (iter != s_activeMemoryRegions.end())
{
MemoryRegion& region = *iter;
int affNow = DeactivateRegion(region, iter, addr, size);
if (affNow)
affected = true;
else if (affected)
break;
if (affNow != 2)
++iter;
}
if (!j) UpdateRamSearchProgressBar(50 + (i * 50 / selCount)), j = 16;
}
UpdateRamSearchTitleBar();
// careful -- if the above two time-saving tricks aren't working,
// the runtime can absolutely explode (seconds -> hours) when there are lots of regions
ListView_SetItemState(ramListControl, -1, 0, LVIS_SELECTED); // deselect all
signal_new_size();
break;
}
default:
rv = false;
needRefresh = false;
break;
}
UpdateRamSearchTitleBar();
// careful -- if the above two time-saving tricks aren't working,
// the runtime can absolutely explode (seconds -> hours) when there are lots of regions
ListView_SetItemState(ramListControl, -1, 0, LVIS_SELECTED); // deselect all
signal_new_size();
{rv = true; break;}
}
}
// check refresh for comparison preview color update
// also, update rs_val if needed
bool needRefresh = false;
switch(LOWORD(wParam))
{
case IDC_LESSTHAN:
case IDC_MORETHAN:
case IDC_NOMORETHAN:
case IDC_NOLESSTHAN:
case IDC_EQUALTO:
case IDC_DIFFERENTFROM:
case IDC_DIFFERENTBY:
case IDC_MODULO:
case IDC_PREVIOUSVALUE:
case IDC_SPECIFICVALUE:
case IDC_SPECIFICADDRESS:
case IDC_NUMBEROFCHANGES:
case IDC_SIGNED:
case IDC_UNSIGNED:
case IDC_HEX:
rs_val_valid = Set_RS_Val();
needRefresh = true;
break;
case IDC_EDIT_COMPAREVALUE:
case IDC_EDIT_COMPAREADDRESS:
case IDC_EDIT_COMPARECHANGES:
case IDC_EDIT_DIFFBY:
case IDC_EDIT_MODBY:
if(HIWORD(wParam) == EN_CHANGE)
if (needRefresh)
{
rs_val_valid = Set_RS_Val();
needRefresh = true;
ListView_Update(GetDlgItem(hDlg, IDC_RAMLIST), -1);
}
break;
return rv;
}
case EN_CHANGE:
{
switch (LOWORD(wParam))
{
case IDC_EDIT_COMPAREVALUE:
case IDC_EDIT_COMPAREADDRESS:
case IDC_EDIT_COMPARECHANGES:
case IDC_EDIT_DIFFBY:
case IDC_EDIT_MODBY:
rs_val_valid = Set_RS_Val();
ListView_Update(GetDlgItem(hDlg, IDC_RAMLIST), -1);
}
}
}
if(needRefresh)
ListView_Update(GetDlgItem(hDlg,IDC_RAMLIST), -1);
return rv;
} break;
}
break;
case WM_CLOSE:
DestroyWindow(hDlg);
break;
case WM_DESTROY:
RamSearchHWnd = NULL;
ReleaseCheatMap();
// theApp.modelessCheatDialogIsOpen = false;
break;
}
@ -2067,6 +2113,7 @@ invalid_field:
return false;
}
void UpdateRamSearchTitleBar(int percent)
{
#define HEADER_STR " RAM Search - "

View File

@ -37,4 +37,10 @@ extern POINT CalcSubWindowPos(HWND hDlg, POINT* conf);
// static int CALLBACK RamSearchItemSortFunc(LPARAM lp1, LPARAM lp2, LPARAM lpSort);
// extern void UpdateSortColumnIcon(HWND hwndListView, int sortColumn, bool sortAsc);
#define CHEAT_1BYTE_BG RGB(216, 203, 253)
#define CHEAT_2BYTE_BG RGB(195, 186, 253)
#define CHEAT_3BYTE_BG RGB(176, 139, 252)
#define CHEAT_4BYTE_BG RGB(175, 94, 253)
#define CHEAT_4BYTE_TEXT RGB(255, 255, 255)
#endif

View File

@ -143,45 +143,37 @@ bool InsertWatch(const AddressWatcher& Watch, HWND parent)
int prevWatchCount = WatchCount;
int tmpWatchIndex;
if (parent == RamWatchHWnd)
tmpWatchIndex = WatchCount;
else if (parent == RamSearchHWnd)
tmpWatchIndex = -2;
else if (parent == hCheat)
tmpWatchIndex = -3;
else
tmpWatchIndex = -4;
rswatches[tmpWatchIndex] = Watch;
rswatches[tmpWatchIndex].CurValue = GetCurrentValue(rswatches[tmpWatchIndex]);
DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_EDITWATCH), parent, EditWatchProc, tmpWatchIndex);
rswatches.erase(tmpWatchIndex);
WatcherMsg msg = WatcherMsg::FromAddressWatches(&Watch);
if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_EDITWATCH), parent, EditWatchProc, (LPARAM)&msg))
{
AddressWatcher* watcher = msg.ToAddressWatches();
InsertWatch(*watcher);
if (watcher->comment)
free(watcher->comment);
free(watcher);
}
if (msg.Addresses) free(msg.Addresses);
if (msg.comment) free(msg.comment);
return WatchCount > prevWatchCount;
}
bool InsertWatches(const AddressWatcher* watches, HWND parent, const int count)
bool InsertWatches(WatcherMsg* msg, HWND parent, int count)
{
if (count == 1)
return InsertWatch(watches[0], parent);
else
bool success = false;
if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_EDITWATCH), parent, EditWatchProc, (LPARAM)msg))
{
bool success = false;
char comment[256];
rswatches[-1] = watches[0];
rswatches[-1].comment = comment;
if(DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_EDITWATCH), parent, EditWatchProc, (LPARAM)-1))
for (int i = 0; i < count; ++i)
{
AddressWatcher watcher = watches[i];
watcher.comment = rswatches[-1].comment;
success |= InsertWatch(watcher);
}
rswatches.erase(-1);
return success;
AddressWatcher* watches = msg->ToAddressWatches();
for (int i = 0; i < count; ++i)
{
success |= InsertWatch(watches[i]);
if (watches[i].comment)
free(watches[i].comment);
}
free(watches);
}
return false;
return success;
}
void Update_RAM_Watch()
@ -781,187 +773,253 @@ INT_PTR CALLBACK EditWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
// since there are 3 windows can pops up the add watch dialog, we should store them separately.
// 0 for ram watch, 1 for ram search, 2 for cheat dialog.
static int indexes[4];
static WatcherMsg* msgs[4];
switch(uMsg)
{
case WM_INITDIALOG:
{
HWND parent = GetParent(hDlg);
WatcherMsg* msg = (WatcherMsg*)lParam;
msgs[GetDlgStoreIndex(parent)] = (WatcherMsg*)msg;
RECT r;
GetWindowRect(hDlg, &r);
SetWindowPos(hDlg, NULL, r.left, r.top, NULL, NULL, SWP_NOSIZE | SWP_NOZORDER | SWP_SHOWWINDOW);
char title[128];
UINT addrCtrlID;
switch (msg->msg)
{
RECT r;
GetWindowRect(hWnd, &r);
SetWindowPos(hDlg, NULL, r.left, r.top, NULL, NULL, SWP_NOSIZE | SWP_NOZORDER | SWP_SHOWWINDOW);
AddressWatcher& watcher = rswatches[lParam];
if (watcher.Type != 'S') {
char Str_Tmp[1024];
// -1 means batch add
if (lParam != -1)
{
sprintf(Str_Tmp, "%04X", watcher.Address);
SetDlgItemText(hDlg, IDC_EDIT_COMPAREADDRESS, Str_Tmp);
} else
// Add multiple watches
SetDlgItemText(hDlg, IDC_EDIT_COMPAREADDRESS, "(multiple)");
switch (watcher.Size)
{
case 'b':
SendDlgItemMessage(hDlg, IDC_1_BYTE, BM_SETCHECK, BST_CHECKED, 0);
break;
case 'w':
SendDlgItemMessage(hDlg, IDC_2_BYTES, BM_SETCHECK, BST_CHECKED, 0);
break;
case 'd':
SendDlgItemMessage(hDlg, IDC_4_BYTES, BM_SETCHECK, BST_CHECKED, 0);
break;
}
switch (watcher.Type)
{
case 's':
SendDlgItemMessage(hDlg, IDC_SIGNED, BM_SETCHECK, BST_CHECKED, 0);
break;
case 'u':
SendDlgItemMessage(hDlg, IDC_UNSIGNED, BM_SETCHECK, BST_CHECKED, 0);
break;
case 'h':
SendDlgItemMessage(hDlg, IDC_HEX, BM_SETCHECK, BST_CHECKED, 0);
break;
case 'b':
SendDlgItemMessage(hDlg, IDC_BINARY, BM_SETCHECK, BST_CHECKED, 0);
break;
}
} else
SetDlgItemText(hDlg, IDC_EDIT_COMPAREADDRESS, "---------");
if (watcher.comment != NULL)
SetDlgItemText(hDlg, IDC_PROMPT_EDIT, watcher.comment);
HWND parent = GetParent(hDlg);
indexes[GetDlgStoreIndex(parent)] = lParam;
if (watcher.Type == 'S' || parent == RamSearchHWnd || parent == hCheat)
{
EnableWindow(GetDlgItem(hDlg, IDC_SPECIFICADDRESS), FALSE);
EnableWindow(GetDlgItem(hDlg, IDC_DATATYPE_GROUPBOX), FALSE);
EnableWindow(GetDlgItem(hDlg, IDC_DATASIZE_GROUPBOX), FALSE);
EnableWindow(GetDlgItem(hDlg, IDC_EDIT_COMPAREADDRESS), FALSE);
EnableWindow(GetDlgItem(hDlg, IDC_SIGNED), FALSE);
EnableWindow(GetDlgItem(hDlg, IDC_UNSIGNED), FALSE);
EnableWindow(GetDlgItem(hDlg, IDC_HEX), FALSE);
EnableWindow(GetDlgItem(hDlg, IDC_BINARY), FALSE);
EnableWindow(GetDlgItem(hDlg, IDC_1_BYTE), FALSE);
EnableWindow(GetDlgItem(hDlg, IDC_2_BYTES), FALSE);
EnableWindow(GetDlgItem(hDlg, IDC_4_BYTES), FALSE);
SetFocus(GetDlgItem(hDlg, IDC_PROMPT_EDIT));
}
case WATCHER_MSG_EDIT:
// Editing multiple watch is currently not supported
addrCtrlID = IDC_EDIT_COMPAREADDRESS;
// limit the length to 4 since currently doesn't support batch editing
SendDlgItemMessage(hDlg, addrCtrlID, EM_SETLIMITTEXT, 4, 0);
strcpy(title, "Edit ");
break;
case WATCHER_MSG_ADD:
strcpy(title, "Add ");
addrCtrlID = IDC_EDIT_COMPAREADDRESSES;
break;
case WATCHER_MSG_DUP:
default:
strcpy(title, "Duplicate ");
addrCtrlID = IDC_EDIT_COMPAREADDRESSES;
break;
}
return true;
break;
// The information is needed to fill to the UI, and separetor doesn't have them
if (msg->Type != 'S')
{
strcat(title, "Watch");
if (msg->Addresses != NULL)
{
// fill the information refers to the message provided
char str_addr[7];
char str_addrs[1024] = { 0 };
// In case more than one watches to be batch added
if (msg->count > 0)
{
// Don't worry about editing a watch since currently doesn't support multiple watch editing, the msg->count would always be 1 in edit mode.
for (int i = 0; i < msg->count; ++i)
{
sprintf(str_addr, "%04X, ", msg->Addresses[i]);
strcat(str_addrs, str_addr);
}
str_addrs[strlen(str_addrs) - 2] = 0;
}
// Set address(es) to the edit control
SetDlgItemText(hDlg, addrCtrlID, str_addrs);
switch (msg->Size)
{
case 'b':
SendDlgItemMessage(hDlg, IDC_1_BYTE, BM_SETCHECK, BST_CHECKED, 0);
break;
case 'w':
SendDlgItemMessage(hDlg, IDC_2_BYTES, BM_SETCHECK, BST_CHECKED, 0);
break;
case 'd':
SendDlgItemMessage(hDlg, IDC_4_BYTES, BM_SETCHECK, BST_CHECKED, 0);
break;
}
switch (msg->Type)
{
case 's':
SendDlgItemMessage(hDlg, IDC_SIGNED, BM_SETCHECK, BST_CHECKED, 0);
break;
case 'u':
SendDlgItemMessage(hDlg, IDC_UNSIGNED, BM_SETCHECK, BST_CHECKED, 0);
break;
case 'h':
SendDlgItemMessage(hDlg, IDC_HEX, BM_SETCHECK, BST_CHECKED, 0);
break;
case 'b':
SendDlgItemMessage(hDlg, IDC_BINARY, BM_SETCHECK, BST_CHECKED, 0);
break;
}
}
}
else
strcat(title, "Separator");
// Set the comment
if (msg->comment != NULL)
SetDlgItemText(hDlg, IDC_PROMPT_EDIT, msg->comment);
// show the proper edit control
ShowWindow(GetDlgItem(hDlg, addrCtrlID), SW_SHOW);
ShowWindow(GetDlgItem(hDlg, IDC_SPECIFICADDRESS), SW_SHOW);
// Adjust the dialog to proper state when editing/adding separator or adding watch from windows other than RAM Watch
if (msg->Type == 'S' || parent != RamWatchHWnd)
{
// same part
EnableWindow(GetDlgItem(hDlg, IDC_DATATYPE_GROUPBOX), FALSE);
EnableWindow(GetDlgItem(hDlg, IDC_DATASIZE_GROUPBOX), FALSE);
EnableWindow(GetDlgItem(hDlg, IDC_SIGNED), FALSE);
EnableWindow(GetDlgItem(hDlg, IDC_UNSIGNED), FALSE);
EnableWindow(GetDlgItem(hDlg, IDC_HEX), FALSE);
EnableWindow(GetDlgItem(hDlg, IDC_BINARY), FALSE);
EnableWindow(GetDlgItem(hDlg, IDC_1_BYTE), FALSE);
EnableWindow(GetDlgItem(hDlg, IDC_2_BYTES), FALSE);
EnableWindow(GetDlgItem(hDlg, IDC_4_BYTES), FALSE);
// When it is a separator, focus on the comment
if (msg->Type == 'S')
SetFocus(GetDlgItem(hDlg, IDC_PROMPT_EDIT));
// When it is from RAM Search or Cheat Window, all the information required was already given, make the addresses read-only
if (parent != RamWatchHWnd)
{
EnableWindow(GetDlgItem(hDlg, addrCtrlID), TRUE);
EnableWindow(GetDlgItem(hDlg, IDC_SPECIFICADDRESS), TRUE);
SetFocus(GetDlgItem(hDlg, IDC_PROMPT_EDIT));
SendDlgItemMessage(hDlg, addrCtrlID, EM_SETREADONLY, TRUE, 0);
}
}
else
{
EnableWindow(GetDlgItem(hDlg, addrCtrlID), TRUE);
EnableWindow(GetDlgItem(hDlg, IDC_SPECIFICADDRESS), TRUE);
SetFocus(GetDlgItem(hDlg, addrCtrlID));
}
// limit the text
DefaultEditCtrlProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hDlg, addrCtrlID), GWL_WNDPROC, (LONG)FilterEditCtrlProc);
SetWindowText(hDlg, title);
}
return false;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDOK:
{
char Str_Tmp[256];
HWND parent = GetParent(hDlg);
int index = indexes[GetDlgStoreIndex(parent)];
WatcherMsg* msg = msgs[GetDlgStoreIndex(parent)];
UINT addrCtrlID;
// not a single watch editing operation
if (index != -1)
switch (msg->msg)
{
// a normal watch, copy it to a temporary one
AddressWatcher watcher = rswatches[index];
// if (watcher.comment != NULL)
// watcher.comment = strcpy((char*)malloc(strlen(watcher.comment) + 2), watcher.comment);
case WATCHER_MSG_EDIT:
addrCtrlID = IDC_EDIT_COMPAREADDRESS;
break;
case WATCHER_MSG_ADD:
case WATCHER_MSG_DUP:
addrCtrlID = IDC_EDIT_COMPAREADDRESSES;
break;
}
// It's from ram watch window, not a separator
// When it's from ram search or cheat window, all the information required is already set,
// so this is also unecessary
if (RamWatchHWnd && RamWatchHWnd == GetParent(hDlg) && watcher.Type != 'S')
{
GetDlgItemText(hDlg, IDC_PROMPT_EDIT, Str_Tmp, 256);
// The information is needed to parse from the UI, and separetor doesn't need them
if (parent == RamWatchHWnd && msg->Type != 'S')
{
// Don't worry about editing mode because it always has only 1 address in the edit control
// type
if (SendDlgItemMessage(hDlg, IDC_SIGNED, BM_GETCHECK, 0, 0) == BST_CHECKED)
watcher.Type = 's';
else if (SendDlgItemMessage(hDlg, IDC_UNSIGNED, BM_GETCHECK, 0, 0) == BST_CHECKED)
watcher.Type = 'u';
else if (SendDlgItemMessage(hDlg, IDC_HEX, BM_GETCHECK, 0, 0) == BST_CHECKED)
watcher.Type = 'h';
else if (SendDlgItemMessage(hDlg, IDC_BINARY, BM_GETCHECK, 0, 0) == BST_CHECKED)
watcher.Type = 'b';
else {
MessageBox(hDlg, "Type must be specified.", "Error", MB_OK | MB_ICONERROR);
return true;
}
// Do the always same part first.
// size
if (SendDlgItemMessage(hDlg, IDC_1_BYTE, BM_GETCHECK, 0, 0) == BST_CHECKED)
watcher.Size = 'b';
else if (SendDlgItemMessage(hDlg, IDC_2_BYTES, BM_GETCHECK, 0, 0) == BST_CHECKED)
watcher.Size = 'w';
else if (SendDlgItemMessage(hDlg, IDC_4_BYTES, BM_GETCHECK, 0, 0) == BST_CHECKED)
watcher.Size = 'd';
else {
MessageBox(hDlg, "Size must be specified.", "Error", MB_OK | MB_ICONERROR);
return true;
}
if (watcher.Type == 'b' && (watcher.Size == 'd' || watcher.Size == 'w'))
{
MessageBox(hDlg, "Only 1 byte is supported on binary format.", "Error", MB_OK | MB_ICONERROR);
return true;
}
// address
GetDlgItemText(hDlg, IDC_EDIT_COMPAREADDRESS, Str_Tmp, 1024);
char *addrstr = Str_Tmp;
if (strlen(Str_Tmp) > 8)
addrstr = &Str_Tmp[strlen(Str_Tmp) - 9];
for (int i = 0; addrstr[i]; ++i)
if (toupper(addrstr[i]) == 'O')
addrstr[i] = '0';
sscanf(addrstr, "%04X", &watcher.Address);
if ((watcher.Address & ~0xFFFFFF) == ~0xFFFFFF)
watcher.Address &= 0xFFFFFF;
if (!IsHardwareAddressValid(watcher.Address))
{
MessageBox(hDlg, "Invalid Address.", "Error", MB_OK | MB_ICONERROR);
return true;
}
// get the type
if (SendDlgItemMessage(hDlg, IDC_SIGNED, BM_GETCHECK, 0, 0) == BST_CHECKED)
msg->Type = 's';
else if (SendDlgItemMessage(hDlg, IDC_UNSIGNED, BM_GETCHECK, 0, 0) == BST_CHECKED)
msg->Type = 'u';
else if (SendDlgItemMessage(hDlg, IDC_HEX, BM_GETCHECK, 0, 0) == BST_CHECKED)
msg->Type = 'h';
else if (SendDlgItemMessage(hDlg, IDC_BINARY, BM_GETCHECK, 0, 0) == BST_CHECKED)
msg->Type = 'b';
else {
MessageBox(hDlg, "Type must be specified.", "Error", MB_OK | MB_ICONERROR);
return true;
}
// comment
GetDlgItemText(hDlg, IDC_PROMPT_EDIT, Str_Tmp, 80);
watcher.comment = Str_Tmp;
// get the size
if (SendDlgItemMessage(hDlg, IDC_1_BYTE, BM_GETCHECK, 0, 0) == BST_CHECKED)
msg->Size = 'b';
else if (SendDlgItemMessage(hDlg, IDC_2_BYTES, BM_GETCHECK, 0, 0) == BST_CHECKED)
msg->Size = 'w';
else if (SendDlgItemMessage(hDlg, IDC_4_BYTES, BM_GETCHECK, 0, 0) == BST_CHECKED)
msg->Size = 'd';
else {
MessageBox(hDlg, "Size must be specified.", "Error", MB_OK | MB_ICONERROR);
return true;
}
// finallly update the watch list
if (index >= 0 && index < WatchCount)
// it's a watch editing operation.
// Only ram watch window can edit a watch, the ram search window and cheat window only add watch.
EditWatch(index, watcher);
if (msg->Type == 'b' && (msg->Size == 'd' || msg->Size == 'w'))
{
MessageBox(hDlg, "Only 1 byte is supported on binary format.", "Error", MB_OK | MB_ICONERROR);
return true;
}
// get the address(es)
char str_addrs[1024];
GetDlgItemText(hDlg, addrCtrlID, str_addrs, 1024);
char* next = strtok(str_addrs, ",");
int i = 0;
unsigned int addrSize = 4;
if (msg->Addresses)
msg->Addresses = (unsigned int*)malloc(sizeof(int) * addrSize);
else
InsertWatch(watcher);
if (RamWatchHWnd)
ListView_SetItemCount(GetDlgItem(RamWatchHWnd, IDC_WATCHLIST), WatchCount);
}
else {
// a multiple watches insert operation, just asking for a comment
AddressWatcher& watcher = rswatches[index];
// comment
GetDlgItemText(hDlg, IDC_PROMPT_EDIT, Str_Tmp, 80);
strcpy(watcher.comment, Str_Tmp);
}
EndDialog(hDlg, true);
msg->Addresses = (unsigned int*)realloc(msg->Addresses, sizeof(int) * addrSize);
RWfileChanged = true;
return true;
break;
do {
sscanf(next, "%04X", &msg->Addresses[i]);
// When an invalid address is in it
if (!IsHardwareAddressValid(msg->Addresses[i]))
{
MessageBox(hDlg, "You have entered an invalid address.", "Error", MB_ICONERROR | MB_OK);
// Comment out, leave it unfreed until next ID_OK event or close the dialog
// free(msg->Addresses);
// msg->Addresses = NULL;
char* start = next + strspn(next, ", ");
char* end = start + strcspn(start, ", ");
SendDlgItemMessage(hDlg, addrCtrlID, EM_SETSEL, start - str_addrs, end - str_addrs);
SetFocus(GetDlgItem(hDlg, addrCtrlID));
return true;
}
++i;
if (i == addrSize)
msg->Addresses = (unsigned int*)realloc(msg->Addresses, sizeof(unsigned int) * (addrSize += 4));
} while (next = strtok(NULL, ","));
msg->count = i;
}
// get the new comment, every AddressWatcher would have a comment, no matter what type it is
if (msg->comment)
msg->comment = (char*)realloc(msg->comment, 1024 * sizeof(char));
else
msg->comment = (char*)malloc(1024 * sizeof(char));
GetDlgItemText(hDlg, IDC_PROMPT_EDIT, msg->comment, 1024);
EndDialog(hDlg, true);
return false;
}
case IDCANCEL:
EndDialog(hDlg, false);
@ -1053,6 +1111,7 @@ INT_PTR CALLBACK RamWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
rwrecentmenu=CreateMenu();
UpdateRW_RMenu(rwrecentmenu, RAMMENU_FILE_RECENT, RW_MENU_FIRST_RECENT_FILE);
CreateCheatMap();
const char* names[3] = {"Address","Value","Notes"};
int widths[3] = {78,64,160};
init_list_box(GetDlgItem(hDlg,IDC_WATCHLIST),names,3,widths);
@ -1213,14 +1272,14 @@ INT_PTR CALLBACK RamWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
SetWindowLongPtr(hDlg, DWLP_MSGRESULT, CDRF_DODEFAULT);
return TRUE;
case 1:
lplvcd->clrTextBk = RGB(216, 203, 253); break;
lplvcd->clrTextBk = CHEAT_1BYTE_BG; break;
case 2:
lplvcd->clrTextBk = RGB(195, 186, 253); break;
lplvcd->clrTextBk = CHEAT_2BYTE_BG; break;
case 3:
lplvcd->clrTextBk = RGB(176, 139, 252); break;
lplvcd->clrTextBk = CHEAT_3BYTE_BG; break;
case 4:
lplvcd->clrTextBk = RGB(175, 94, 253);
lplvcd->clrText = RGB(255, 255, 255); break; // use a more visual color in dark background
lplvcd->clrTextBk = CHEAT_4BYTE_BG;
lplvcd->clrText = CHEAT_4BYTE_TEXT; break; // use a more visual color in dark background
}
SetWindowLongPtr(hDlg, DWLP_MSGRESULT, CDRF_NEWFONT);
}
@ -1301,19 +1360,43 @@ INT_PTR CALLBACK RamWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
watchIndex = ListView_GetSelectionMark(GetDlgItem(hDlg,IDC_WATCHLIST));
if(watchIndex != -1)
{
DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_EDITWATCH), hDlg, EditWatchProc, watchIndex);
SetFocus(GetDlgItem(hDlg,IDC_WATCHLIST));
WatcherMsg msg = WatcherMsg::FromAddressWatches(&rswatches[watchIndex]);
msg.msg = WATCHER_MSG_EDIT;
if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_EDITWATCH), hDlg, EditWatchProc, (LPARAM)&msg))
{
AddressWatcher watcher = msg.ToAddressWatches()[0];
EditWatch(watchIndex, watcher);
SetFocus(GetDlgItem(hDlg, IDC_WATCHLIST));
if (watcher.comment)
free(watcher.comment);
}
if (msg.Addresses)
free(msg.Addresses);
if (msg.comment)
free(msg.comment);
}
return true;
case IDC_C_WATCH:
{
AddressWatcher& target = rswatches[WatchCount];
target.Address = 0;
target.WrongEndian = 0;
target.Size = 'b';
target.Type = 's';
DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_EDITWATCH), hDlg, EditWatchProc, WatchCount);
SetFocus(GetDlgItem(hDlg, IDC_WATCHLIST));
WatcherMsg msg;
msg.Addresses = (unsigned int*)calloc(1, sizeof(unsigned int));
msg.WrongEndian = 0;
msg.Size = 'b';
msg.Type = 's';
if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_EDITWATCH), hDlg, EditWatchProc, (LPARAM)&msg))
{
AddressWatcher* target = msg.ToAddressWatches();
for (int i = 0; i < msg.count; ++i)
InsertWatch(target[i]);
SetFocus(GetDlgItem(hDlg, IDC_WATCHLIST));
if (target->comment)
free(target->comment);
free(target);
}
if (msg.Addresses)
free(msg.Addresses);
if (msg.comment)
free(msg.comment);
return true;
}
case IDC_C_WATCH_DUPLICATE:
@ -1321,27 +1404,46 @@ INT_PTR CALLBACK RamWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
watchIndex = ListView_GetSelectionMark(GetDlgItem(hDlg, IDC_WATCHLIST));
if (watchIndex != -1)
{
char str_tmp[1024];
AddressWatcher* target = &rswatches[WatchCount];
AddressWatcher* source = &rswatches[watchIndex];
memcpy(target, source, sizeof(AddressWatcher));
target->comment = strcpy(str_tmp, source->comment);
DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_EDITWATCH), hDlg, EditWatchProc, WatchCount);
SetFocus(GetDlgItem(hDlg, IDC_WATCHLIST));
WatcherMsg msg = WatcherMsg::FromAddressWatches(&rswatches[watchIndex]);
msg.msg = WATCHER_MSG_DUP;
if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_EDITWATCH), hDlg, EditWatchProc, (LPARAM)&msg))
{
SetFocus(GetDlgItem(hDlg, IDC_WATCHLIST));
int count;
AddressWatcher* target = msg.ToAddressWatches(&count);
for (int i = 0; i < count; ++i)
{
InsertWatch(target[i]);
if (target[i].comment)
free(target[i].comment);
}
}
if(msg.Addresses)
free(msg.Addresses);
if(msg.comment)
free(msg.comment);
}
return true;
}
case IDC_C_WATCH_SEPARATE:
{
AddressWatcher* target = &rswatches[WatchCount];
target->Address = 0;
target->WrongEndian = false;
target->Size = 'S';
target->Type = 'S';
WatcherMsg msg;
msg.WrongEndian = 0;
msg.Size = 'S';
msg.Type = 'S';
msg.msg = WATCHER_MSG_ADD;
msg.count = 1;
DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_EDITWATCH), hDlg, EditWatchProc, (LPARAM)WatchCount);
if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_EDITWATCH), hDlg, EditWatchProc, (LPARAM)&msg))
{
AddressWatcher* sep = msg.ToAddressWatches();
InsertWatch(*sep);
if (sep->comment)
free(sep->comment);
}
if (msg.comment)
free(msg.comment);
// InsertWatch(separator, "----------------------------");
SetFocus(GetDlgItem(hDlg, IDC_WATCHLIST));
return true;
}
@ -1500,6 +1602,8 @@ INT_PTR CALLBACK RamWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
// release the hdc related objects
SeparatorCache::DeInit();
// release cheatmap
ReleaseCheatMap();
break;
case WM_DROPFILES:
@ -1584,3 +1688,59 @@ SeparatorCache::SeparatorCache(HWND hwnd, char* text) {
labelOffY = 0;
}
}
AddressWatcher* WatcherMsg::ToAddressWatches(int* _count)
{
AddressWatcher* watches = (AddressWatcher*)malloc(count * sizeof(AddressWatcher));
int i = 0;
while(i < count)
{
AddressWatcher watcher;
watcher.Size = Size;
if (Type != 'S')
watcher.Address = Addresses[i];
watcher.Type = Type;
watcher.WrongEndian = 0;
if (comment)
{
watcher.comment = (char*)malloc(strlen(comment) * sizeof(char) + 1);
strcpy(watcher.comment, comment);
}
else
watcher.comment = NULL;
watches[i] = watcher;
++i;
}
if (_count)
*_count = i;
return watches;
}
WatcherMsg WatcherMsg::FromAddressWatches(const AddressWatcher* watches, int count)
{
WatcherMsg msg;
if (watches[0].comment)
{
msg.comment = (char*)malloc(strlen(watches[0].comment) + 1);
strcpy(msg.comment, watches[0].comment);
}
msg.count = count;
msg.Size = watches->Size;
msg.Type = watches->Type;
msg.WrongEndian = watches->WrongEndian;
// Because currently doesn't support adding multiple separators at once,
// and a separator doesn't have address values,
// so when add separator, there's only 1 item in the list
if (watches->Type != 'S')
{
msg.Addresses = (unsigned int*)malloc(count * sizeof(unsigned int));
for (int i = 0; i < count; ++i)
msg.Addresses[i] = watches[i].Address;
}
return msg;
}

View File

@ -39,6 +39,7 @@ struct SeparatorCache
};
#define MAX_WATCH_COUNT 256
extern int WatchCount; // number of valid items in rswatches
extern char Watch_Dir[1024];
@ -58,9 +59,28 @@ struct AddressWatcher
short Cheats; // how many bytes are affected by cheat
};
// the struct for communicating with add watch window
#define WATCHER_MSG_ADD 0
#define WATCHER_MSG_EDIT 1
#define WATCHER_MSG_DUP 2
struct WatcherMsg {
int msg = WATCHER_MSG_ADD;
int count = 0; // how many addresses are there
unsigned int* Addresses = NULL; // Address list
char* comment = NULL;
bool WrongEndian;
char Size;
char Type;
AddressWatcher* ToAddressWatches(int* _count = NULL);
static WatcherMsg FromAddressWatches(const AddressWatcher* watches, int count = 1);
};
bool InsertWatch(const AddressWatcher& Watch);
bool InsertWatch(const AddressWatcher& Watch, HWND parent); // asks user for comment
bool InsertWatches(const AddressWatcher* watches, HWND parent, const int count);
bool InsertWatches(WatcherMsg* msg, HWND parent, int count);
bool InsertWatch(int watchIndex, const AddressWatcher& watcher);
bool EditWatch(int watchIndex, const AddressWatcher& watcher);
bool RemoveWatch(int watchIndex);

View File

@ -50,14 +50,10 @@ END
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ICON3 ICON "res/taseditor-icon.ico"
IDI_ICON4 ICON "res/taseditor-icon32.ico"
ICON_1 ICON "res/ICON_1.ico"
ICON_2 ICON "res/ICON_2.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Menu
@ -713,44 +709,44 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTIO
CAPTION "Directories Configuration"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
LTEXT "Base &Directory",IDC_STATIC,10,10,47,8
EDITTEXT EDIT_ROOT,71,9,158,12,ES_AUTOHSCROLL
PUSHBUTTON "Browse...",BUTTON_ROOT,239,8,56,14
LTEXT "&Roms",IDC_STATIC,10,28,19,8
EDITTEXT EDIT_ROM,71,27,158,12,ES_AUTOHSCROLL
PUSHBUTTON "Browse...",BUTTON_ROM,239,26,56,14
LTEXT "&Battery Saves",IDC_STATIC,10,46,45,8
EDITTEXT EDIT_BATTERY,71,45,158,12,ES_AUTOHSCROLL
PUSHBUTTON "Browse...",BUTTON_BATTERY,239,44,56,14
LTEXT "&Save States",IDC_STATIC,10,64,41,9
EDITTEXT EDIT_STATE,71,63,158,12,ES_AUTOHSCROLL
PUSHBUTTON "Browse...",BUTTON_STATE,239,62,56,14
LTEXT "&FDS Bios Rom",IDC_STATIC,10,82,47,8
EDITTEXT EDIT_FDSBIOS,71,81,158,12,ES_AUTOHSCROLL
PUSHBUTTON "Browse...",BUTTON_FDSBIOS,239,80,56,14
LTEXT "Screens&hots",IDC_STATIC,10,100,40,8
EDITTEXT EDIT_SCREENSHOT,71,99,158,12,ES_AUTOHSCROLL
PUSHBUTTON "Browse...",BUTTON_SCREENSHOT,239,98,56,14
LTEXT "Chea&ts",IDC_STATIC,10,118,23,8
EDITTEXT EDIT_CHEAT,71,117,158,12,ES_AUTOHSCROLL
PUSHBUTTON "Browse...",BUTTON_CHEAT,239,116,56,14
LTEXT "&Movies",IDC_STATIC,10,136,24,8
EDITTEXT EDIT_MOVIE,71,135,158,12,ES_AUTOHSCROLL
PUSHBUTTON "Browse...",BUTTON_MOVIE,239,134,56,14
LTEXT "Memory &Watch",IDC_STATIC,10,154,52,9
EDITTEXT EDIT_MEMWATCH,71,153,158,12,ES_AUTOHSCROLL
PUSHBUTTON "Browse...",BUTTON_MEMWATCH,239,152,56,14
LTEXT "&Input Presets",IDC_STATIC,10,172,42,8
EDITTEXT EDIT_PRESET,71,171,158,12,ES_AUTOHSCROLL
PUSHBUTTON "Browse...",210,239,170,56,14
LTEXT "&Lua Scripts",IDC_STATIC,10,190,36,8
EDITTEXT EDIT_LUA,71,189,158,12,ES_AUTOHSCROLL
PUSHBUTTON "Browse...",211,239,188,56,14
LTEXT "A&vi Output",IDC_STATIC,10,208,34,8
EDITTEXT EDIT_AVI,71,207,158,12,ES_AUTOHSCROLL
PUSHBUTTON "Browse...",BUTTON_AVI,239,206,56,14
DEFPUSHBUTTON "OK",CLOSE_BUTTON,175,230,56,14
PUSHBUTTON "Cancel",BTN_CANCEL,239,230,56,14
EDITTEXT 113,71,9,158,12,ES_AUTOHSCROLL
EDITTEXT EDIT_ROMS,71,27,158,12,ES_AUTOHSCROLL
EDITTEXT 101,71,45,158,12,ES_AUTOHSCROLL
EDITTEXT 102,71,63,158,12,ES_AUTOHSCROLL
EDITTEXT 103,71,81,158,12,ES_AUTOHSCROLL
EDITTEXT 104,71,99,158,12,ES_AUTOHSCROLL
EDITTEXT 105,71,117,158,12,ES_AUTOHSCROLL
EDITTEXT 106,71,135,158,12,ES_AUTOHSCROLL
EDITTEXT 107,71,153,158,12,ES_AUTOHSCROLL
EDITTEXT 110,71,171,158,12,ES_AUTOHSCROLL
EDITTEXT 111,71,189,158,12,ES_AUTOHSCROLL
EDITTEXT 112,71,207,158,12,ES_AUTOHSCROLL
PUSHBUTTON "Browse...",213,239,8,56,14
PUSHBUTTON "Browse...",BUTTON_ROMS,239,26,56,14
PUSHBUTTON "Browse...",201,239,44,56,14
PUSHBUTTON "Browse...",202,239,62,56,14
PUSHBUTTON "Browse...",203,239,80,56,14
PUSHBUTTON "Browse...",204,239,98,56,14
PUSHBUTTON "Browse...",205,239,116,56,14
PUSHBUTTON "Browse...",206,239,134,56,14
PUSHBUTTON "Browse...",207,239,152,56,14
PUSHBUTTON "Browse...",210,239,170,56,14
PUSHBUTTON "Browse...",211,239,188,56,14
PUSHBUTTON "Browse...",212,239,206,56,14
LTEXT "Base Directory",IDC_STATIC,10,10,47,8
LTEXT "Roms",IDC_STATIC,10,28,19,8
LTEXT "Battery Saves",IDC_STATIC,10,46,45,8
LTEXT "Save States",IDC_STATIC,10,64,41,9
LTEXT "FDS Bios Rom",IDC_STATIC,10,82,47,8
LTEXT "Screenshots",IDC_STATIC,10,100,40,8
LTEXT "Cheats",IDC_STATIC,10,118,23,8
LTEXT "Movies",IDC_STATIC,10,136,24,8
LTEXT "Memory Watch",IDC_STATIC,10,154,52,9
LTEXT "Input Presets",IDC_STATIC,10,172,42,8
LTEXT "Lua Scripts",IDC_STATIC,10,190,36,8
LTEXT "Avi Output",IDC_STATIC,10,208,34,8
END
DWBDIALOG DIALOG 33, 99, 250, 56
@ -880,7 +876,6 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTIO
CAPTION "GUI Configuration"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
DEFPUSHBUTTON "Close",BTN_CLOSE,65,136,56,14
CONTROL "Load ""File Open"" dialog when FCEUX starts.",CB_LOAD_FILE_OPEN,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,8,168,12
CONTROL "Automatically hide menu on game load.",CB_AUTO_HIDE_MENU,
@ -895,6 +890,7 @@ BEGIN
CONTROL "Partially disable Visual Themes (Requires restart)",CB_PARTIALVISUALTHEME,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,100,168,12
CONTROL "Single Instance Mode",IDC_SINGLEINSTANCE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,117,167,10
DEFPUSHBUTTON "Close",BTN_CLOSE,65,136,56,14
END
INPUTCONFIG DIALOGEX 122, 105, 349, 199
@ -950,7 +946,6 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTIO
CAPTION "mahjong"
FONT 8, "MS Shell Dlg"
BEGIN
DEFPUSHBUTTON "Close",BTN_CLOSE,277,91,56,14
GROUPBOX "",321,8,8,324,73,WS_GROUP
PUSHBUTTON "A",300,14,42,16,12
PUSHBUTTON "B",301,36,42,16,12
@ -973,6 +968,7 @@ BEGIN
PUSHBUTTON " ",318,212,58,16,12
PUSHBUTTON " ",319,234,58,16,12
PUSHBUTTON " ",320,256,58,16,12
DEFPUSHBUTTON "Close",BTN_CLOSE,277,91,56,14
END
MAPINPUT DIALOGEX 0, 0, 318, 294
@ -984,8 +980,8 @@ BEGIN
PUSHBUTTON "Cancel",BTN_CANCEL,205,274,50,14
CONTROL "List2",LV_MAPPING,"SysListView32",LVS_REPORT | WS_BORDER | WS_TABSTOP,7,7,304,243
PUSHBUTTON "Restore Defaults",BTN_RESTORE_DEFAULTS,7,274,75,14
COMBOBOX COMBO_FILTER,32,255,279,193,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
RTEXT "Filter:",65484,6,255,21,12,SS_CENTERIMAGE | NOT WS_GROUP
COMBOBOX COMBO_FILTER,32,255,279,193,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
END
MESSAGELOG DIALOGEX 33, 38, 197, 229
@ -1035,31 +1031,31 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTIO
CAPTION "Palette Configuration"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
DEFPUSHBUTTON "Close",BUTTON_CLOSE,162,195,56,14
GROUPBOX "NES Palette",302,10,8,102,81,WS_GROUP
DEFPUSHBUTTON "&Load Palette...",BTN_PALETTE_LOAD,18,39,58,14
CONTROL "Enabled",CHECK_PALETTE_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,122,22,87,12
CTEXT "Tint",65463,123,34,85,8,WS_DISABLED
CONTROL "Tint",CTL_TINT_TRACKBAR,"msctls_trackbar32",WS_DISABLED | WS_TABSTOP,121,44,91,11
GROUPBOX "NTSC Color Emulation",101,115,8,103,81,WS_GROUP
CONTROL "Hue",CTL_HUE_TRACKBAR,"msctls_trackbar32",WS_DISABLED | WS_TABSTOP,121,69,91,11
CTEXT "Hue",64395,124,59,85,8,WS_DISABLED
CTEXT "Tint",65463,123,34,85,8,WS_DISABLED
CONTROL "Hue",CTL_HUE_TRACKBAR,"msctls_trackbar32",WS_DISABLED | WS_TABSTOP,121,69,91,11
CONTROL "Force Grayscale",CHECK_PALETTE_GRAYSCALE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,57,85,12
CONTROL "Use Custom Palette",CHECK_PALETTE_CUSTOM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,22,85,12
GROUPBOX "PAL Emulation",IDC_STATIC,10,89,208,66,WS_DISABLED
CONTROL "",CTL_PALSAT_TRACKBAR,"msctls_trackbar32",TBS_NOTICKS | WS_DISABLED | WS_TABSTOP,78,110,70,15
LTEXT "Saturation:",STATIC_SATVALUE,83,100,58,8,WS_DISABLED
CONTROL "",CTL_PALSAT_TRACKBAR,"msctls_trackbar32",TBS_NOTICKS | WS_DISABLED | WS_TABSTOP,78,110,70,15
PUSHBUTTON "Reset",BTN_PALETTE_RESET,161,132,50,14,WS_DISABLED
CONTROL "",CTL_PALNOTCH_TRACKBAR,"msctls_trackbar32",TBS_NOTICKS | WS_DISABLED | WS_TABSTOP,11,110,68,15
LTEXT "Notch:",STATIC_NOTCHVALUE,16,100,46,8,WS_DISABLED
CONTROL "",CTL_PALSHARP_TRACKBAR,"msctls_trackbar32",TBS_NOTICKS | WS_DISABLED | WS_TABSTOP,156,109,61,15
CONTROL "",CTL_PALNOTCH_TRACKBAR,"msctls_trackbar32",TBS_NOTICKS | WS_DISABLED | WS_TABSTOP,11,110,68,15
LTEXT "Sharpness:",STATIC_SHARPVALUE,161,99,50,8,WS_DISABLED
CONTROL "",CTL_PALSHARP_TRACKBAR,"msctls_trackbar32",TBS_NOTICKS | WS_DISABLED | WS_TABSTOP,156,109,61,15
LTEXT "NTSC Color Emulation overrides Internal default Palette.\nIndividual Game Palette overrides Internal+NTSC Palettes.\nCustom Palette overrides all of the above.\nPAL Emulation overrides other choices when PAL filter is selected",IDC_STATIC,10,159,208,33
CONTROL "",CTL_PALCONTRAST_TRACKBAR,"msctls_trackbar32",TBS_NOTICKS | WS_DISABLED | WS_TABSTOP,11,134,67,15
LTEXT "Contrast: ",STATIC_CONTRASTVALUE,16,126,55,8,WS_DISABLED
CONTROL "",CTL_PALBRIGHT_TRACKBAR,"msctls_trackbar32",TBS_NOTICKS | WS_DISABLED | WS_TABSTOP,78,133,70,15
CONTROL "",CTL_PALCONTRAST_TRACKBAR,"msctls_trackbar32",TBS_NOTICKS | WS_DISABLED | WS_TABSTOP,11,134,67,15
LTEXT "Brightness: ",STATIC_BRIGHTVALUE,83,125,61,8,WS_DISABLED
CONTROL "",CTL_PALBRIGHT_TRACKBAR,"msctls_trackbar32",TBS_NOTICKS | WS_DISABLED | WS_TABSTOP,78,133,70,15
CONTROL "De-emphasis bit swap",CHECK_DEEMPH_SWAP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,73,83,10
DEFPUSHBUTTON "Close",BUTTON_CLOSE,162,195,56,14
END
POWERPADDIALOG DIALOG 30, 123, 131, 119
@ -1280,16 +1276,16 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIB
CAPTION "Timing Configuration"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
DEFPUSHBUTTON "Close",1,137,87,56,14
CONTROL "Disable speed throttling used when sound is disabled.",CB_DISABLE_SPEED_THROTTLING,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,8,183,12
CONTROL "Set high-priority thread.",CB_SET_HIGH_PRIORITY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,24,102,12
CONTROL "Overclocking (old PPU only).",CB_OVERCLOCKING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,41,101,10
EDITTEXT IDC_EXTRA_SCANLINES,104,55,84,14,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED
LTEXT "Post-render scanlines:",IDC_EXTRA_SCANLINES_TEXT,21,57,74,8,WS_DISABLED
EDITTEXT IDC_EXTRA_SCANLINES,104,55,84,14,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED
CONTROL "Don't overclock 7-bit samples.",CB_SKIP_7BIT,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,10,87,111,10
EDITTEXT IDC_VBLANK_SCANLINES,104,68,84,14,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED
LTEXT "VBlank scanlines:",IDC_VBLANK_SCANLINES_TEXT,21,71,76,8,WS_DISABLED
EDITTEXT IDC_VBLANK_SCANLINES,104,68,84,14,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED
DEFPUSHBUTTON "Close",1,137,87,56,14
END
MOVIEOPTIONS DIALOGEX 65520, 76, 147, 222
@ -1297,7 +1293,6 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTIO
CAPTION "Movie Options"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
DEFPUSHBUTTON "Close",IDC_MOVIE_CLOSE,48,200,49,14,BS_CENTER
CONTROL "Pause after playback",IDC_MOVIE_PAUSEAFTERPLAYBACK,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,26,110,10
CONTROL "Bind savestates to movies",IDC_MOVIE_BINDSAVESTATES,
@ -1317,6 +1312,7 @@ BEGIN
CONTROL "Always suggest Read-Only replay",IDC_MOVIE_SUGGEST_READONLY,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,8,125,10
LTEXT "(VBA-rr and SNES9x style)",IDC_STATIC,25,184,93,8
DEFPUSHBUTTON "Close",IDC_MOVIE_CLOSE,48,200,49,14,BS_CENTER
END
DWBDIALOGSIMPLE DIALOGEX 33, 99, 250, 39
@ -1546,8 +1542,8 @@ CAPTION "Add Breakpoint..."
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
LTEXT "&Address:",-1,14,6,30,10
EDITTEXT IDC_ADDBP_ADDR_START,48,4,30,12,ES_UPPERCASE | ES_WANTRETURN
CTEXT "-",65534,78,6,8,8
EDITTEXT IDC_ADDBP_ADDR_START,48,4,30,12,ES_UPPERCASE | ES_WANTRETURN
EDITTEXT IDC_ADDBP_ADDR_END,87,4,30,12,ES_UPPERCASE | ES_WANTRETURN
CONTROL "&Forbid",IDC_ADDBP_MODE_F,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,154,6,33,12
GROUPBOX "",112,3,18,185,50,WS_TABSTOP
@ -1596,7 +1592,7 @@ BEGIN
END
ROMPATCHER DIALOGEX 84, 67, 304, 135
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Rom Data Editor"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
@ -1690,16 +1686,16 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPT
CAPTION "Find"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
LTEXT "Find &What:",-1,7,9,38,8
EDITTEXT IDC_MEMVIEWFIND_WHAT,47,7,171,14,ES_AUTOHSCROLL
LTEXT "Find What:",-1,7,9,38,8
GROUPBOX "Type",-1,83,29,187,45
CONTROL "Hex",IDC_MEMVIEWFIND_TYPE_HEX,"Button",BS_AUTORADIOBUTTON | WS_GROUP,93,43,29,10
CONTROL "Text (Uses Currently Loaded Table as Reference)",IDC_MEMVIEWFIND_TYPE_TEXT,
CONTROL "&Hex",IDC_MEMVIEWFIND_TYPE_HEX,"Button",BS_AUTORADIOBUTTON | WS_GROUP,93,43,29,10
CONTROL "&Text (Uses Currently Loaded Table as Reference)",IDC_MEMVIEWFIND_TYPE_TEXT,
"Button",BS_AUTORADIOBUTTON,93,56,172,10
GROUPBOX "Direction",-1,9,29,65,44
CONTROL "Up",IDC_MEMVIEWFIND_DIR_UP,"Button",BS_AUTORADIOBUTTON | WS_GROUP,18,43,25,10
CONTROL "Down",IDC_MEMVIEWFIND_DIR_DOWN,"Button",BS_AUTORADIOBUTTON,18,56,35,10
DEFPUSHBUTTON "Find Next",IDC_MEMVIEWFIND_NEXT,225,7,50,14
CONTROL "&Up",IDC_MEMVIEWFIND_DIR_UP,"Button",BS_AUTORADIOBUTTON | WS_GROUP,18,43,25,10
CONTROL "&Down",IDC_MEMVIEWFIND_DIR_DOWN,"Button",BS_AUTORADIOBUTTON,18,56,35,10
DEFPUSHBUTTON "&Find Next",IDC_MEMVIEWFIND_NEXT,225,7,50,14
END
IDD_RECORDINP DIALOGEX 0, 0, 276, 86
@ -1707,16 +1703,16 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTI
CAPTION "Record input"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
DEFPUSHBUTTON "OK",1,167,66,50,14
GROUPBOX "",65501,3,0,269,60
RTEXT "File:",65500,28,11,24,10,SS_CENTERIMAGE | NOT WS_GROUP,WS_EX_RIGHT
PUSHBUTTON "Cancel",2,221,66,50,14
RTEXT "&File:",65500,28,11,24,10,SS_CENTERIMAGE | NOT WS_GROUP,WS_EX_RIGHT
EDITTEXT IDC_EDIT_FILENAME,55,10,189,12,ES_AUTOHSCROLL
PUSHBUTTON "...",IDC_BUTTON_BROWSEFILE,249,10,18,14
RTEXT "&Record From:",65498,9,27,43,8,0,WS_EX_RIGHT
COMBOBOX IDC_COMBO_RECORDFROM,55,25,189,154,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
RTEXT "Record From:",65498,9,27,43,8,0,WS_EX_RIGHT
RTEXT "&Author:",65502,18,43,34,10,SS_CENTERIMAGE | NOT WS_GROUP,WS_EX_RIGHT
EDITTEXT IDC_EDIT_AUTHOR,55,41,189,14,ES_AUTOHSCROLL
RTEXT "Author:",65502,18,43,34,10,SS_CENTERIMAGE | NOT WS_GROUP,WS_EX_RIGHT
DEFPUSHBUTTON "OK",1,167,66,50,14
PUSHBUTTON "Cancel",2,221,66,50,14
END
IDD_REPLAYINP DIALOGEX 0, 0, 300, 202
@ -1724,36 +1720,36 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTI
CAPTION "Play Movie"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
DEFPUSHBUTTON "OK",1,189,183,50,14
GROUPBOX "",65497,3,0,293,180
RTEXT "File:",65498,8,11,24,10,SS_CENTERIMAGE | NOT WS_GROUP
COMBOBOX IDC_COMBO_FILENAME,35,10,257,128,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Cancel",2,243,183,50,14
RTEXT "Length:",64397,10,67,59,8
EDITTEXT IDC_LABEL_LENGTH,76,67,59,12,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP
RTEXT "Frames:",65496,10,78,59,8
EDITTEXT IDC_LABEL_FRAMES,76,78,59,12,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP
RTEXT "Record Count:",65495,10,89,59,8
EDITTEXT IDC_LABEL_UNDOCOUNT,76,89,59,12,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP
RTEXT "ROM Used:",65493,10,111,59,8
EDITTEXT IDC_LABEL_ROMUSED,76,111,187,12,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP
RTEXT "ROM Checksum:",65492,10,122,59,8
EDITTEXT IDC_LABEL_ROMCHECKSUM,76,122,155,12,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP
RTEXT "Recorded From:",65491,10,100,59,8
EDITTEXT IDC_LABEL_RECORDEDFROM,76,100,123,12,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP
RTEXT "Emulator Used:",65490,10,144,59,8
EDITTEXT IDC_LABEL_EMULATORUSED,76,144,155,12,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP
RTEXT "Current ROM Sum:",65489,8,133,61,8
EDITTEXT IDC_LABEL_CURRCHECKSUM,76,133,155,12,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP
CONTROL "Pause movie at frame",IDC_CHECK_STOPMOVIE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,49,83,10
EDITTEXT IDC_EDIT_STOPFRAME,103,47,39,12,ES_AUTOHSCROLL | ES_NUMBER
GROUPBOX "Parameters",IDC_STATIC,13,25,278,40
PUSHBUTTON "Metadata...",IDC_BUTTON_METADATA,239,71,50,14
EDITTEXT IDC_LABEL_EMULATORUSED,76,144,155,12,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP
EDITTEXT IDC_LABEL_CURRCHECKSUM,76,133,155,12,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP
EDITTEXT IDC_LABEL_ROMCHECKSUM,76,122,155,12,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP
EDITTEXT IDC_LABEL_ROMUSED,76,111,187,12,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP
EDITTEXT IDC_LABEL_RECORDEDFROM,76,100,123,12,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP
CONTROL "Open &Read-Only",IDC_CHECK_READONLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,36,69,10
EDITTEXT IDC_LABEL_UNDOCOUNT,76,89,59,12,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP
EDITTEXT IDC_LABEL_FRAMES,76,78,59,12,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP
EDITTEXT IDC_LABEL_LENGTH,76,67,59,12,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP
RTEXT "Pal:",65494,10,155,59,8
EDITTEXT IDC_LABEL_PALUSED,76,155,155,12,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP
RTEXT "New PPU:",65499,10,166,59,8
EDITTEXT IDC_LABEL_NEWPPUUSED,76,166,155,12,ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP
DEFPUSHBUTTON "OK",1,189,183,50,14
PUSHBUTTON "Cancel",2,243,183,50,14
END
TASEDITOR DIALOGEX 0, 0, 326, 348
@ -1825,16 +1821,16 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTI
CAPTION "Create New Project"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,7,80,50,14
PUSHBUTTON "Cancel",IDCANCEL,114,80,50,14
CONTROL " Copy current Input",IDC_COPY_INPUT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,80,14,75,10
CONTROL " 1 player",IDC_RADIO_1PLAYER,"Button",BS_AUTORADIOBUTTON,16,14,45,10
CONTROL " 2 players",IDC_RADIO_2PLAYERS,"Button",BS_AUTORADIOBUTTON,16,27,45,10
CONTROL " Fourscore",IDC_RADIO_FOURSCORE,"Button",BS_AUTORADIOBUTTON,16,40,45,10
CONTROL " Copy current Markers",IDC_COPY_MARKERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,80,27,83,10
GROUPBOX "Input type",IDC_STATIC,5,3,67,52,BS_CENTER
EDITTEXT IDC_EDIT_AUTHOR,36,61,127,13,ES_AUTOHSCROLL
LTEXT "Author:",IDC_STATIC,8,63,26,9
EDITTEXT IDC_EDIT_AUTHOR,36,61,127,13,ES_AUTOHSCROLL
DEFPUSHBUTTON "OK",IDOK,7,80,50,14
PUSHBUTTON "Cancel",IDCANCEL,114,80,50,14
END
IDD_TASEDITOR_EXPORT DIALOGEX 0, 0, 158, 86
@ -1842,13 +1838,13 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIB
CAPTION "Export to FM2"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Export",IDOK,7,66,50,14
PUSHBUTTON "Cancel",IDCANCEL,100,66,50,14
CONTROL " 1 player",IDC_RADIO_1PLAYER,"Button",BS_AUTORADIOBUTTON | WS_GROUP,8,8,47,10
CONTROL " 2 players",IDC_RADIO_2PLAYERS,"Button",BS_AUTORADIOBUTTON,8,21,47,10
CONTROL " Fourscore",IDC_RADIO_FOURSCORE,"Button",BS_AUTORADIOBUTTON,8,35,47,10
CONTROL " Convert Marker Notes to Movie Subtitles",IDC_NOTES_TO_SUBTITLES,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,50,146,10
DEFPUSHBUTTON "Export",IDOK,7,66,50,14
PUSHBUTTON "Cancel",IDCANCEL,100,66,50,14
END
IDD_TASEDITOR_FINDNOTE DIALOGEX 0, 0, 228, 49
@ -2085,16 +2081,16 @@ CAPTION "Lua Script"
MENU LUAWINDOW_MENU
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
PUSHBUTTON "&Browse...",IDC_BUTTON_LUABROWSE,7,31,48,16
PUSHBUTTON "&Run",IDC_BUTTON_LUARUN,213,31,50,16
PUSHBUTTON "&Stop",IDC_BUTTON_LUASTOP,160,31,50,16
EDITTEXT IDC_EDIT_LUAPATH,7,16,256,14,ES_AUTOHSCROLL
EDITTEXT IDC_EDIT_LUAARGS,47,50,216,14,ES_AUTOHSCROLL
EDITTEXT IDC_LUACONSOLE,7,80,256,60,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL
LTEXT "Output Console:",IDC_STATIC,7,70,56,8
LTEXT "Script File:",IDC_STATIC,7,7,36,8
LTEXT "Arguments:",IDC_STATIC,7,52,40,8
EDITTEXT IDC_EDIT_LUAPATH,7,16,256,14,ES_AUTOHSCROLL
PUSHBUTTON "&Browse...",IDC_BUTTON_LUABROWSE,7,31,48,16
PUSHBUTTON "Edit",IDC_BUTTON_LUAEDIT,58,31,46,16
PUSHBUTTON "&Stop",IDC_BUTTON_LUASTOP,160,31,50,16
PUSHBUTTON "&Run",IDC_BUTTON_LUARUN,213,31,50,16
LTEXT "Output Console:",IDC_STATIC,7,70,56,8
EDITTEXT IDC_LUACONSOLE,7,80,256,60,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL
LTEXT "Arguments:",IDC_STATIC,7,52,40,8
EDITTEXT IDC_EDIT_LUAARGS,47,50,216,14,ES_AUTOHSCROLL
END
VIDEOCONFIG DIALOGEX 65520, 76, 511, 170
@ -2134,12 +2130,12 @@ BEGIN
COMBOBOX IDC_VIDEOCONFIG_SYNC_METHOD_WIN,236,106,103,47,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
GROUPBOX "Drawing Area",65494,351,50,154,65,WS_GROUP
LTEXT "First line:",65436,367,68,40,9
LTEXT "Last line:",65435,367,84,40,9
CTEXT "NTSC",65434,413,57,27,8
CTEXT "PAL/Dendy",65433,455,57,48,8
EDITTEXT IDC_SCANLINE_FIRST_NTSC,414,66,27,12,ES_RIGHT | ES_NUMBER
EDITTEXT IDC_SCANLINE_LAST_NTSC,414,83,27,12,ES_RIGHT | ES_NUMBER
CTEXT "PAL/Dendy",65433,455,57,48,8
EDITTEXT IDC_SCANLINE_FIRST_PAL,465,66,27,12,ES_RIGHT | ES_NUMBER
LTEXT "Last line:",65435,367,84,40,9
EDITTEXT IDC_SCANLINE_LAST_NTSC,414,83,27,12,ES_RIGHT | ES_NUMBER
EDITTEXT IDC_SCANLINE_LAST_PAL,465,83,27,12,ES_RIGHT | ES_NUMBER
CONTROL "Clip left and right sides (8 px on each)",IDC_VIDEOCONFIG_CLIPSIDES,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,357,98,140,12
@ -2158,8 +2154,8 @@ BEGIN
EDITTEXT IDC_TVASPECT_Y,458,28,41,12,ES_AUTOHSCROLL | WS_DISABLED
CTEXT "/",IDC_STATIC_SLASHTEXT,449,31,8,8,WS_DISABLED
LTEXT "DirectDraw:",65454,11,126,46,10
LTEXT "DirectDraw:",65455,188,125,46,10
COMBOBOX IDC_VIDEOCONFIG_DIRECTDRAW_FS,59,123,105,50,CBS_DROPDOWNLIST | WS_TABSTOP
LTEXT "DirectDraw:",65455,188,125,46,10
COMBOBOX IDC_VIDEOCONFIG_DIRECTDRAW_WIN,236,123,103,47,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
END
@ -2192,7 +2188,7 @@ BEGIN
CONTROL "Number of Changes:",IDC_NUMBEROFCHANGES,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,121,212,76,10
EDITTEXT IDC_EDIT_COMPAREVALUE,203,187,63,12,ES_UPPERCASE | ES_AUTOHSCROLL | WS_DISABLED
EDITTEXT IDC_EDIT_COMPAREADDRESS,203,199,63,12,ES_UPPERCASE | ES_AUTOHSCROLL | WS_DISABLED
EDITTEXT IDC_EDIT_COMPARECHANGES,203,211,63,12,ES_UPPERCASE | ES_AUTOHSCROLL | WS_DISABLED
EDITTEXT IDC_EDIT_COMPARECHANGES,203,211,63,12,ES_UPPERCASE | ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED
GROUPBOX "Data Type / Display",IDC_STATIC,196,228,75,45,0,WS_EX_TRANSPARENT
CONTROL "Signed",IDC_SIGNED,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,200,238,67,9
CONTROL "Unsigned",IDC_UNSIGNED,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,200,249,67,9
@ -2232,8 +2228,9 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSM
CAPTION " Edit Watch"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CTEXT "&Address:",IDC_SPECIFICADDRESS,15,12,30,8
EDITTEXT IDC_EDIT_COMPAREADDRESS,48,10,65,12,ES_UPPERCASE | ES_AUTOHSCROLL
CTEXT "&Address:",IDC_SPECIFICADDRESS,15,12,30,8,NOT WS_VISIBLE | WS_DISABLED
EDITTEXT IDC_EDIT_COMPAREADDRESS,48,10,65,12,ES_UPPERCASE | ES_AUTOHSCROLL | NOT WS_VISIBLE | WS_DISABLED
EDITTEXT IDC_EDIT_COMPAREADDRESSES,48,10,65,12,ES_UPPERCASE | ES_AUTOHSCROLL | NOT WS_VISIBLE | WS_DISABLED
CTEXT "&Notes:",IDC_PROMPT_TEXT,23,24,22,8
EDITTEXT IDC_PROMPT_EDIT,48,22,119,12,ES_AUTOHSCROLL
GROUPBOX "Data Type",IDC_DATATYPE_GROUPBOX,14,37,75,53,0,WS_EX_TRANSPARENT
@ -2245,8 +2242,8 @@ BEGIN
CONTROL "&1 byte",IDC_1_BYTE,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,98,47,61,11
CONTROL "&2 bytes",IDC_2_BYTES,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,98,57,61,11
CONTROL "&4 bytes",IDC_4_BYTES,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,98,67,61,11
DEFPUSHBUTTON "&OK",IDOK,66,93,50,14
PUSHBUTTON "&Cancel",IDCANCEL,118,93,50,14
DEFPUSHBUTTON "OK",IDOK,66,93,50,14
PUSHBUTTON "Cancel",IDCANCEL,118,93,50,14
END
DLG_SNESPAD DIALOGEX 4, 109, 243, 121
@ -2306,16 +2303,16 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSM
CAPTION "Symbolic Debug Naming"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,132,62,50,14
PUSHBUTTON "Cancel",IDCANCEL,189,62,50,14
LTEXT "File",IDC_STATIC,7,7,15,9
EDITTEXT IDC_SYMBOLIC_ADDRESS,38,24,33,13,ES_AUTOHSCROLL | ES_READONLY | NOT WS_TABSTOP
EDITTEXT IDC_SYMBOLIC_FILENAME,24,6,215,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_TABSTOP
LTEXT "Address",IDC_STATIC,6,26,30,10
EDITTEXT IDC_SYMBOLIC_NAME,107,24,132,13,ES_AUTOHSCROLL
EDITTEXT IDC_SYMBOLIC_ADDRESS,38,24,33,13,ES_AUTOHSCROLL | ES_READONLY | NOT WS_TABSTOP
LTEXT "Name",IDC_STATIC,83,26,22,10
EDITTEXT IDC_SYMBOLIC_NAME,107,24,132,13,ES_AUTOHSCROLL
LTEXT "Comment",IDC_STATIC,6,45,37,10
EDITTEXT IDC_SYMBOLIC_COMMENT,45,43,194,13,ES_AUTOHSCROLL
EDITTEXT IDC_SYMBOLIC_FILENAME,24,6,215,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_TABSTOP
DEFPUSHBUTTON "OK",IDOK,132,62,50,14
PUSHBUTTON "Cancel",IDCANCEL,189,62,50,14
END
IDD_REPLAY_METADATA DIALOGEX 0, 0, 325, 250
@ -2324,7 +2321,7 @@ CAPTION "Movie Metadata"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Close",IDCANCEL,268,229,50,14
CONTROL "",IDC_LIST1,"SysListView32",LVS_REPORT | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,7,7,311,214
CONTROL "",IDC_LIST1,"SysListView32",LVS_REPORT | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,7,311,214
END
IDD_EDIT_HEADER DIALOGEX 0, 0, 321, 258
@ -2775,6 +2772,11 @@ BEGIN
0
END
IDD_RAMSEARCH AFX_DIALOG_LAYOUT
BEGIN
0
END
/////////////////////////////////////////////////////////////////////////////
//
@ -2843,214 +2845,110 @@ END
//
IDB_BITMAP0 BITMAP "res\\te_0.bmp"
IDB_BITMAP1 BITMAP "res\\te_1.bmp"
IDB_BITMAP2 BITMAP "res\\te_2.bmp"
IDB_BITMAP3 BITMAP "res\\te_3.bmp"
IDB_BITMAP4 BITMAP "res\\te_4.bmp"
IDB_BITMAP5 BITMAP "res\\te_5.bmp"
IDB_BITMAP6 BITMAP "res\\te_6.bmp"
IDB_BITMAP7 BITMAP "res\\te_7.bmp"
IDB_BITMAP8 BITMAP "res\\te_8.bmp"
IDB_BITMAP9 BITMAP "res\\te_9.bmp"
IDB_BITMAP10 BITMAP "res\\te_10.bmp"
IDB_BITMAP11 BITMAP "res\\te_11.bmp"
IDB_BITMAP12 BITMAP "res\\te_12.bmp"
IDB_BITMAP13 BITMAP "res\\te_13.bmp"
IDB_BITMAP14 BITMAP "res\\te_14.bmp"
IDB_BITMAP15 BITMAP "res\\te_15.bmp"
IDB_BITMAP16 BITMAP "res\\te_16.bmp"
IDB_BITMAP17 BITMAP "res\\te_17.bmp"
IDB_BITMAP18 BITMAP "res\\te_18.bmp"
IDB_BITMAP19 BITMAP "res\\te_19.bmp"
IDB_TE_ARROW BITMAP "res\\te_arrow.bmp"
IDB_TE_GREEN_ARROW BITMAP "res\\te_green_arrow.bmp"
IDB_TE_GREEN_BLUE_ARROW BITMAP "res\\te_green_blue_arrow.bmp"
IDB_PIANO_0 BITMAP "res\\te_piano_0.bmp"
IDB_PIANO_1 BITMAP "res\\te_piano_1.bmp"
IDB_PIANO_2 BITMAP "res\\te_piano_2.bmp"
IDB_PIANO_3 BITMAP "res\\te_piano_3.bmp"
IDB_PIANO_4 BITMAP "res\\te_piano_4.bmp"
IDB_PIANO_5 BITMAP "res\\te_piano_5.bmp"
IDB_PIANO_6 BITMAP "res\\te_piano_6.bmp"
IDB_PIANO_7 BITMAP "res\\te_piano_7.bmp"
IDB_PIANO_8 BITMAP "res\\te_piano_8.bmp"
IDB_PIANO_9 BITMAP "res\\te_piano_9.bmp"
IDB_PIANO_10 BITMAP "res\\te_piano_10.bmp"
IDB_PIANO_11 BITMAP "res\\te_piano_11.bmp"
IDB_PIANO_12 BITMAP "res\\te_piano_12.bmp"
IDB_PIANO_13 BITMAP "res\\te_piano_13.bmp"
IDB_PIANO_14 BITMAP "res\\te_piano_14.bmp"
IDB_PIANO_15 BITMAP "res\\te_piano_15.bmp"
IDB_PIANO_16 BITMAP "res\\te_piano_16.bmp"
IDB_PIANO_17 BITMAP "res\\te_piano_17.bmp"
IDB_PIANO_18 BITMAP "res\\te_piano_18.bmp"
IDB_PIANO_19 BITMAP "res\\te_piano_19.bmp"
IDB_PIANO_PLAYBACK_0 BITMAP "res\\te_piano_0_playback.bmp"
IDB_PIANO_PLAYBACK_1 BITMAP "res\\te_piano_1_playback.bmp"
IDB_PIANO_PLAYBACK_2 BITMAP "res\\te_piano_2_playback.bmp"
IDB_PIANO_PLAYBACK_3 BITMAP "res\\te_piano_3_playback.bmp"
IDB_PIANO_PLAYBACK_4 BITMAP "res\\te_piano_4_playback.bmp"
IDB_PIANO_PLAYBACK_5 BITMAP "res\\te_piano_5_playback.bmp"
IDB_PIANO_PLAYBACK_6 BITMAP "res\\te_piano_6_playback.bmp"
IDB_PIANO_PLAYBACK_7 BITMAP "res\\te_piano_7_playback.bmp"
IDB_PIANO_PLAYBACK_8 BITMAP "res\\te_piano_8_playback.bmp"
IDB_PIANO_PLAYBACK_9 BITMAP "res\\te_piano_9_playback.bmp"
IDB_PIANO_PLAYBACK_10 BITMAP "res\\te_piano_10_playback.bmp"
IDB_PIANO_PLAYBACK_11 BITMAP "res\\te_piano_11_playback.bmp"
IDB_PIANO_PLAYBACK_12 BITMAP "res\\te_piano_12_playback.bmp"
IDB_PIANO_PLAYBACK_13 BITMAP "res\\te_piano_13_playback.bmp"
IDB_PIANO_PLAYBACK_14 BITMAP "res\\te_piano_14_playback.bmp"
IDB_PIANO_PLAYBACK_15 BITMAP "res\\te_piano_15_playback.bmp"
IDB_PIANO_PLAYBACK_16 BITMAP "res\\te_piano_16_playback.bmp"
IDB_PIANO_PLAYBACK_17 BITMAP "res\\te_piano_17_playback.bmp"
IDB_PIANO_PLAYBACK_18 BITMAP "res\\te_piano_18_playback.bmp"
IDB_PIANO_PLAYBACK_19 BITMAP "res\\te_piano_19_playback.bmp"
IDB_PIANO_LOSTPOS_0 BITMAP "res\\te_piano_0_lostpos.bmp"
IDB_PIANO_LOSTPOS_1 BITMAP "res\\te_piano_1_lostpos.bmp"
IDB_PIANO_LOSTPOS_2 BITMAP "res\\te_piano_2_lostpos.bmp"
IDB_PIANO_LOSTPOS_3 BITMAP "res\\te_piano_3_lostpos.bmp"
IDB_PIANO_LOSTPOS_4 BITMAP "res\\te_piano_4_lostpos.bmp"
IDB_PIANO_LOSTPOS_5 BITMAP "res\\te_piano_5_lostpos.bmp"
IDB_PIANO_LOSTPOS_6 BITMAP "res\\te_piano_6_lostpos.bmp"
IDB_PIANO_LOSTPOS_7 BITMAP "res\\te_piano_7_lostpos.bmp"
IDB_PIANO_LOSTPOS_8 BITMAP "res\\te_piano_8_lostpos.bmp"
IDB_PIANO_LOSTPOS_9 BITMAP "res\\te_piano_9_lostpos.bmp"
IDB_PIANO_LOSTPOS_10 BITMAP "res\\te_piano_10_lostpos.bmp"
IDB_PIANO_LOSTPOS_11 BITMAP "res\\te_piano_11_lostpos.bmp"
IDB_PIANO_LOSTPOS_12 BITMAP "res\\te_piano_12_lostpos.bmp"
IDB_PIANO_LOSTPOS_13 BITMAP "res\\te_piano_13_lostpos.bmp"
IDB_PIANO_LOSTPOS_14 BITMAP "res\\te_piano_14_lostpos.bmp"
IDB_PIANO_LOSTPOS_15 BITMAP "res\\te_piano_15_lostpos.bmp"
IDB_PIANO_LOSTPOS_16 BITMAP "res\\te_piano_16_lostpos.bmp"
IDB_PIANO_LOSTPOS_17 BITMAP "res\\te_piano_17_lostpos.bmp"
IDB_PIANO_LOSTPOS_18 BITMAP "res\\te_piano_18_lostpos.bmp"
IDB_PIANO_LOSTPOS_19 BITMAP "res\\te_piano_19_lostpos.bmp"
IDB_BITMAP_SELECTED0 BITMAP "res\\te_0_selected.bmp"
IDB_BITMAP_SELECTED1 BITMAP "res\\te_1_selected.bmp"
IDB_BITMAP_SELECTED2 BITMAP "res\\te_2_selected.bmp"
IDB_BITMAP_SELECTED3 BITMAP "res\\te_3_selected.bmp"
IDB_BITMAP_SELECTED4 BITMAP "res\\te_4_selected.bmp"
IDB_BITMAP_SELECTED5 BITMAP "res\\te_5_selected.bmp"
IDB_BITMAP_SELECTED6 BITMAP "res\\te_6_selected.bmp"
IDB_BITMAP_SELECTED7 BITMAP "res\\te_7_selected.bmp"
IDB_BITMAP_SELECTED8 BITMAP "res\\te_8_selected.bmp"
IDB_BITMAP_SELECTED9 BITMAP "res\\te_9_selected.bmp"
IDB_BITMAP_SELECTED10 BITMAP "res\\te_10_selected.bmp"
IDB_BITMAP_SELECTED11 BITMAP "res\\te_11_selected.bmp"
IDB_BITMAP_SELECTED12 BITMAP "res\\te_12_selected.bmp"
IDB_BITMAP_SELECTED13 BITMAP "res\\te_13_selected.bmp"
IDB_BITMAP_SELECTED14 BITMAP "res\\te_14_selected.bmp"
IDB_BITMAP_SELECTED15 BITMAP "res\\te_15_selected.bmp"
IDB_BITMAP_SELECTED16 BITMAP "res\\te_16_selected.bmp"
IDB_BITMAP_SELECTED17 BITMAP "res\\te_17_selected.bmp"
IDB_BITMAP_SELECTED18 BITMAP "res\\te_18_selected.bmp"
IDB_BITMAP_SELECTED19 BITMAP "res\\te_19_selected.bmp"
IDB_BRANCH_SPRITESHEET BITMAP "res\\branch_spritesheet.bmp"
#endif // English (United States) resources
#endif // English(United States) resources
/////////////////////////////////////////////////////////////////////////////

View File

@ -1,12 +1,12 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file
// for res.rc
// Microsoft Visual C++ 生成的包含文件。
// 供 res.rc 使用
//
#define CLOSE_BUTTON 1
#define BUTTON_CLOSE 1
#define BTN_CLOSE 1
#define MENU_OPEN_FILE 100
#define EDIT_ROMS 100
#define EDIT_ROM 100
#define LBL_LOG_TEXT 100
#define LBL_KEY_COMBO 100
#define LBL_CDLOGGER_CODECOUNT 100
@ -31,6 +31,7 @@
#define IDC_ROMPATCHER_DOTNES_OFFSET 101
#define IDC_NTVIEW_TABLE_BOX 101
#define IDC_ASSEMBLER_DISASSEMBLY 101
#define EDIT_BATTERY 101
#define MENU_RECENT_FILES 102
#define CB_LOAD_FILE_OPEN 102
#define LBL_CDLOGGER_UNDEFCOUNT 102
@ -46,6 +47,7 @@
#define IDC_NTVIEW_SCANLINE 102
#define IDC_ASSEMBLER_PATCH_DISASM 102
#define CHECK_PALETTE_GRAYSCALE 102
#define EDIT_STATE 102
#define BTN_CDLOGGER_RESET 103
#define LBL_PPUVIEW_TILE1 103
#define IDC_CHEAT_VAL 103
@ -56,6 +58,7 @@
#define IDC_ROMPATCHER_BTN_EDIT 103
#define IDC_NTVIEW_PROPERTIES_LINE_1 103
#define IDC_VIDEOCONFIG_HIDEMOUSE 103
#define EDIT_FDSBIOS 103
#define CB_AUTO_HIDE_MENU 104
#define COMBO_PAD1 104
#define BTN_CDLOGGER_LOAD 104
@ -69,6 +72,7 @@
#define IDC_ROMPATCHER_CURRENT_DATA_BOX 104
#define IDC_NTVIEW_PROPERTIES_LINE_2 104
#define CHECK_PALETTE_CUSTOM 104
#define EDIT_SCREENSHOT 104
#define COMBO_PAD2 105
#define CB_SET_HIGH_PRIORITY 105
#define BTN_CDLOGGER_START_PAUSE 105
@ -81,6 +85,7 @@
#define IDC_ADDBP_MEM_CPU 105
#define IDC_ROMPATCHER_CURRENT_DATA 105
#define IDC_NTVIEW_PROPERTIES_LINE_3 105
#define EDIT_CHEAT 105
#define BTN_PORT1 106
#define BTN_CDLOGGER_SAVE_AS 106
#define IDC_CHEAT_LIST_POSSIBILITIES 106
@ -89,18 +94,21 @@
#define IDC_ADDBP_MEM_PPU 106
#define IDC_NTVIEW_PROPERTIES_LINE_4 106
#define IDC_TEXT_LINES_TO_THIS_WINDOW 106
#define EDIT_MOVIE 106
#define BTN_PORT2 107
#define BTN_CDLOGGER_SAVE 107
#define IDC_DEBUGGER_STEP_OVER 107
#define IDC_ADDBP_MEM_SPR 107
#define IDC_ROMPATCHER_DISASSEMBLY 107
#define IDC_VIDEOCONFIG_BESTFIT 107
#define EDIT_MEMWATCH 107
#define IDR_ACCELERATOR1 108
#define BTN_CDLOGGER_SAVE_STRIPPED 108
#define IDC_CHEAT_VAL_NE_BY 108
#define IDC_DEBUGGER_SEEK_PC 108
#define IDR_TASEDITOR_ACCELERATORS 108
#define IDC_VIDEOCONFIG_CONSOLE_BGCOLOR 108
#define EDIT_BOT 108
#define IDC_CHEAT_VAL_GT_BY 109
#define IDC_DEBUGGER_SEEK_TO 109
#define IDC_ROMPATCHER_PATCH_DATA 109
@ -108,6 +116,7 @@
#define BTN_CDLOGGER_SAVE_UNUSED 109
#define IDC_VIDEOCONFIG_TVASPECT 109
#define IDC_GROUP_LOG_OPTIONS 109
#define EDIT_MACRO 109
#define IDC_CHEAT_VAL_LT_BY 110
#define MENU_SAVE_STATE 110
#define CB_ASK_EXIT 110
@ -118,6 +127,7 @@
#define IDC_ROMPATCHER_BTN_APPLY 110
#define LBL_CDLOGGER_RENDERCOUNT 110
#define IDC_VIDEOCONFIG_SQUARE_PIXELS 110
#define EDIT_PRESET 110
#define MENU_LOAD_STATE 111
#define CB_DISABLE_SCREEN_SAVER 111
#define BTN_FAM 111
@ -126,12 +136,15 @@
#define IDC_ROMPATCHER_BTN_SAVE 111
#define IDC_CHEAT_COM 111
#define IDC_VIDEOCONFIG_DIRECTDRAW_FS 111
#define EDIT_LUA 111
#define BTN_AUTO_HOLD 112
#define IDC_BTN_LOG_BROWSE 112
#define IDC_DEBUGGER_BOOKMARK_ADD 112
#define IDC_VIDEOCONFIG_DIRECTDRAW_WIN 112
#define EDIT_AVI 112
#define IDC_DEBUGGER_BOOKMARK_DEL 113
#define IDC_EXTRA_LOG_OPTIONS 113
#define EDIT_ROOT 113
#define BTN_CLEAR_AH 114
#define IDC_CHECK_LOG_NEW_INSTRUCTIONS 114
#define IDC_DEBUGGER_RUN_LINE 114
@ -203,7 +216,7 @@
#define IDD_TASEDITOR_FINDNOTE 198
#define IDD_TASEDITOR_ABOUT 199
#define MENU_RESET 200
#define BUTTON_ROMS 200
#define BUTTON_ROM 200
#define TXT_PAD1 200
#define BTN_RESTORE_DEFAULTS 200
#define BTN_CLEAR 200
@ -232,6 +245,7 @@
#define IDC_ASSEMBLER_APPLY 201
#define IDI_ICON4 201
#define BTN_OK 201
#define BUTTON_BATTERY 201
#define MENU_EJECT_DISK 202
#define TXT_FAM 202
#define MENU_MV_EDIT_PASTE 202
@ -241,6 +255,7 @@
#define IDC_ASSEMBLER_SAVE 202
#define IDD_TASEDITOR_NEWPROJECT 202
#define IDC_GROUPBOX_CHEATSEARCH 202
#define BUTTON_STATE 202
#define MENU_SWITCH_DISK 203
#define IDC_NETMOO_NICK 203
#define IDC_CHEAT_BOX_POSSIBILITIES 203
@ -248,24 +263,35 @@
#define IDC_DEBUGGER_FLAG_B 203
#define IDC_ADDBP_NAME 203
#define IDC_ASSEMBLER_UNDO 203
#define BUTTON_FDSBIOS 203
#define MENU_INSERT_COIN 204
#define COMBO_NETMOO_LOCAL_PLAYERS 204
#define IDC_DEBUGGER_FLAG_D 204
#define IDC_GROUP_PREV_COM 204
#define BUTTON_SCREENSHOT 204
#define IDC_NETMOO_KEY 205
#define IDC_DEBUGGER_FLAG_I 205
#define IDB_TE_GREEN_ARROW 205
#define BUTTON_CHEAT 205
#define IDC_NETMOO_PASS 206
#define IDC_DEBUGGER_FLAG_Z 206
#define BUTTON_MOVIE 206
#define IDC_DEBUGGER_FLAG_C 207
#define BUTTON_MEMWATCH 207
#define IDC_DEBUGGER_ENABLE_SYMBOLIC 208
#define IDB_TE_GREEN_BLUE_ARROW 208
#define BUTTON_BOT 208
#define IDB_PIANO_0 209
#define IDC_DEBUGGER_ROM_OFFSETS 209
#define BUTTON_MACRO 209
#define IDB_PIANO_1 210
#define BUTTON_PRESET 210
#define IDB_PIANO_2 211
#define BUTTON_LUA 211
#define IDB_PIANO_3 212
#define BUTTON_AVI 212
#define IDB_PIANO_4 213
#define BUTTON_ROOT 213
#define IDB_PIANO_5 214
#define IDB_PIANO_6 215
#define IDB_PIANO_7 216
@ -739,6 +765,7 @@
#define IDC_EDIT_COMPAREVALUE 1225
#define IDC_EDIT_COMPAREADDRESS 1226
#define IDC_EDIT_COMPARECHANGES 1227
#define IDC_EDIT_COMPAREADDRESSES 1227
#define IDC_SIGNED 1228
#define IDC_UNSIGNED 1229
#define IDC_HEX 1230

View File

@ -3272,7 +3272,7 @@ LRESULT APIENTRY FilterEditCtrlProc(HWND hwnd, UINT msg, WPARAM wP, LPARAM lP)
case WM_PASTE:
{
bool(*IsLetterLegal)(char) = GetIsLetterLegal(GetDlgCtrlID(hwnd));
bool (*IsLetterLegal)(char) = GetIsLetterLegal(GetDlgCtrlID(hwnd));
if (IsLetterLegal)
{
@ -3293,13 +3293,12 @@ LRESULT APIENTRY FilterEditCtrlProc(HWND hwnd, UINT msg, WPARAM wP, LPARAM lP)
{
through = false;
// Show Edit control tip, just like the control with ES_NUMBER do
ShowLetterIllegalError(hwnd, IsLetterLegal);
ShowLetterIllegalBalloonTip(hwnd, IsLetterLegal);
break;
}
}
GlobalUnlock(handle);
CloseClipboard();
}
}
}
@ -3308,9 +3307,9 @@ LRESULT APIENTRY FilterEditCtrlProc(HWND hwnd, UINT msg, WPARAM wP, LPARAM lP)
case WM_CHAR:
{
bool(*IsLetterLegal)(char) = GetIsLetterLegal(GetDlgCtrlID(hwnd));
through = IsInputLegal(GetIsLetterLegal(GetDlgCtrlID(hwnd)), wP);
through = IsInputLegal(IsLetterLegal, wP);
if (!through)
ShowLetterIllegalError(hwnd, IsLetterLegal);
ShowLetterIllegalBalloonTip(hwnd, IsLetterLegal);
}
}
@ -3322,9 +3321,6 @@ bool inline (*GetIsLetterLegal(UINT id))(char letter)
{
switch (id)
{
// owomomo TODO: RAM Search is a bit complicated,
// I'll handle it in later development
// Game genie text in Cheat and Game Genie Encoder/Decoder
case IDC_CHEAT_GAME_GENIE_TEXT:
@ -3342,10 +3338,6 @@ bool inline (*GetIsLetterLegal(UINT id))(char letter)
// Debugger -> Add breakpoint
case IDC_ADDBP_ADDR_START: case IDC_ADDBP_ADDR_END:
// RAM Watch / RAM Search / Cheat -> Add watch
// TODO: Some other features
// case IDC_EDIT_COMPAREADDRESS:
// Address, Value, Compare, Known Value, Note equal, Greater than and Less than in Cheat
case IDC_CHEAT_ADDR: case IDC_CHEAT_VAL: case IDC_CHEAT_COM:
case IDC_CHEAT_VAL_KNOWN: case IDC_CHEAT_VAL_NE_BY:
@ -3361,8 +3353,15 @@ bool inline (*GetIsLetterLegal(UINT id))(char letter)
case MW_ADDR12: case MW_ADDR13: case MW_ADDR14: case MW_ADDR15:
case MW_ADDR16: case MW_ADDR17: case MW_ADDR18: case MW_ADDR19:
case MW_ADDR20: case MW_ADDR21: case MW_ADDR22: case MW_ADDR23:
case IDC_EDIT_COMPAREADDRESS:
return IsLetterLegalHex;
// Specific Address in RAM Search
// RAM Watch / RAM Search / Cheat -> Add watch (current only in adding watch operation)
case IDC_EDIT_COMPAREADDRESSES:
return IsLetterLegalHexList;
// Size multiplier and TV Aspect in Video Config
case IDC_WINSIZE_MUL_X: case IDC_WINSIZE_MUL_Y:
case IDC_TVASPECT_X: case IDC_TVASPECT_Y:
@ -3372,67 +3371,87 @@ bool inline (*GetIsLetterLegal(UINT id))(char letter)
case IDC_CHEAT_TEXT:
return IsLetterLegalCheat;
// PRG ROM, PRG RAM, PRG NVRAM, CHR ROM, CHR RAM, CHR NVRAM in iNES Header Editor
// PRG ROM, PRG RAM, PRG NVRAM, CHR ROM, CHR RAM and CHR NVRAM in iNES Header Editor
case IDC_PRGROM_EDIT: case IDC_PRGRAM_EDIT: case IDC_PRGNVRAM_EDIT:
case IDC_CHRROM_EDIT: case IDC_CHRRAM_EDIT: case IDC_CHRNVRAM_EDIT:
return IsLetterLegalSize;
// Specific value, Different by and Modulo in RAM search
case IDC_EDIT_COMPAREVALUE:
case IDC_EDIT_DIFFBY:
case IDC_EDIT_MODBY:
{
extern char rs_t;
switch (rs_t)
{
case 's': return IsLetterLegalDecHexMixed;
case 'u': return IsLetterLegalUnsignedDecHexMixed;
case 'h': return IsLetterLegalHex;
}
}
}
return NULL;
}
inline void ShowLetterIllegalError(HWND hwnd, bool(*IsLetterLegal)(char letter), bool balloon)
{
(balloon ? ShowLetterIllegalBalloonTip : ShowLetterIllegalMessageBox)(hwnd, IsLetterLegal);
}
void ShowLetterIllegalBalloonTip(HWND hwnd, bool(*IsLetterLegal)(char letter))
{
char* title = "Unacceptable Character";
int uLen = MultiByteToWideChar(CP_ACP, NULL, title, -1, NULL, 0);
wchar_t* titleW = (wchar_t*)malloc(sizeof(wchar_t) * uLen);
MultiByteToWideChar(CP_ACP, 0, title, -1, (LPWSTR)titleW, uLen);
char* msg = GetLetterIllegalErrMsg(IsLetterLegal);
uLen = MultiByteToWideChar(CP_ACP, NULL, msg, -1, NULL, 0);
wchar_t* msgW = (wchar_t*)malloc(sizeof(wchar_t) * uLen);
MultiByteToWideChar(CP_ACP, 0, msg, -1, (LPWSTR)msgW, uLen);
wchar_t* title = L"Unacceptable Character";
wchar_t* msg = GetLetterIllegalErrMsg(IsLetterLegal);
EDITBALLOONTIP tip;
tip.cbStruct = sizeof(EDITBALLOONTIP);
tip.pszText = msgW;
tip.pszTitle = titleW;
tip.pszText = msg;
tip.pszTitle = title;
tip.ttiIcon = TTI_ERROR;
SendMessage(hwnd, EM_SHOWBALLOONTIP, 0, (LPARAM)&tip);
free(titleW);
free(msgW);
// make a sound
MessageBeep(0xFFFFFFFF);
}
inline void ShowLetterIllegalMessageBox(HWND hwnd, bool(*IsLetterLegal)(char letter))
{
MessageBox(hwnd, GetLetterIllegalErrMsg(IsLetterLegal), "Unacceptable Character", MB_OK | MB_ICONERROR);
}
inline char* GetLetterIllegalErrMsg(bool(*IsLetterLegal)(char letter))
inline wchar_t* GetLetterIllegalErrMsg(bool(*IsLetterLegal)(char letter))
{
if (IsLetterLegal == IsLetterLegalGG)
return "You can only type Game Genie characters:\nA P Z L G I T Y E O X U K S V N";
return L"You can only type Game Genie characters:\nA P Z L G I T Y E O X U K S V N";
if (IsLetterLegal == IsLetterLegalHex)
return "You can only type characters for hexadecimal number (0-9,A-F).";
return L"You can only type characters for hexadecimal number (0-9,A-F).";
if (IsLetterLegal == IsLetterLegalHexList)
return L"You can only type characters for hexademical number (0-9,A-F), each number is separated by a comma (,)";
if (IsLetterLegal == IsLetterLegalCheat)
return
"The cheat code comes into the following 2 formats:\n"
L"The cheat code comes into the following 2 formats:\n"
"AAAA:VV freezes the value in Address $AAAA to $VV.\n"
"AAAA?CC:VV changes the value in Address $AAAA to $VV only when it's $CC.\n"
"All the characters are hexadecimal number (0-9,A-F).\n";
if (IsLetterLegal == IsLetterLegalFloat)
return "You can only type decimal number (decimal point is acceptable).";
return L"You can only type decimal number (decimal point is acceptable).";
if (IsLetterLegal == IsLetterLegalSize)
return "You can only type decimal number followed with B, KB or MB.";
return L"You can only type decimal number followed with B, KB or MB.";
if (IsLetterLegal == IsLetterLegalDec)
return "You can only type decimal number (minus is acceptable).";
return L"You can only type decimal number (sign character is acceptable).";
if (IsLetterLegal == IsLetterLegalDecHexMixed)
return
L"You can only type decimal or hexademical number\n"
"(sign character is acceptable).\n\n"
"When your number contains letter A-F,\n"
"it is regarded as hexademical number,\n"
"however, if you want to express a heademical number\n"
"but all the digits are in 0-9,\n"
"you must add a $ prefix to prevent ambiguous.\n"
"eg. 10 is a decimal number,\n"
"$10 means a hexademical number that is 16 in decimal.";
if (IsLetterLegal == IsLetterLegalUnsignedDecHexMixed)
return
L"You can only type decimal or hexademical number.\n\n"
"When your number contains letter A-F,\n"
"it is regarded as hexademical number,\n"
"however, if you want to express a heademical number\n"
"but all the digits are in 0-9,\n"
"you must add a $ prefix to prevent ambiguous.\n"
"eg. 10 is a decimal number,\n"
"$10 means a hexademical number that is 16 in decimal.";
return "Your input contains invalid characters.";
return L"Your input contains invalid characters.";
}
inline bool IsInputLegal(bool (*IsLetterLegal)(char letter), char letter)
@ -3454,6 +3473,11 @@ inline bool IsLetterLegalHex(char letter)
return letter >= '0' && letter <= '9' || letter >= 'A' && letter <= 'F' || letter >= 'a' && letter <= 'f';
}
inline bool IsLetterLegalHexList(char letter)
{
return IsLetterLegalHex(letter) || letter == ',' || letter == ' ';
}
inline bool IsLetterLegalCheat(char letter)
{
return letter >= '0' && letter <= ':' || letter >= 'A' && letter <= 'F' || letter >= 'a' && letter <= 'f' || letter == '?';
@ -3466,10 +3490,20 @@ inline bool IsLetterLegalSize(char letter)
inline bool IsLetterLegalDec(char letter)
{
return letter >= '0' && letter <= '9' || letter == '-';
return letter >= '0' && letter <= '9' || letter == '-' || letter == '+';
}
inline bool IsLetterLegalFloat(char letter)
{
return letter >= '0' && letter <= '9' || letter == '.';
return letter >= '0' && letter <= '9' || letter == '.' || letter == '-' || letter == '+';
}
inline bool IsLetterLegalDecHexMixed(char letter)
{
return letter >= '0' && letter <= '9' || letter >= 'A' && letter <= 'F' || letter >= 'a' && letter <= 'f' || letter == '$' || letter == '-' || letter == '+';
}
inline bool IsLetterLegalUnsignedDecHexMixed(char letter)
{
return letter >= '0' && letter <= '9' || letter >= 'A' && letter <= 'F' || letter >= 'a' && letter <= 'f' || letter == '$';
}

View File

@ -129,17 +129,18 @@ void UpdateMenuHotkeys(FCEUMENU_INDEX index);
int GetCurrentContextIndex();
inline bool (*GetIsLetterLegal(UINT id))(char letter);
inline char* GetLetterIllegalErrMsg(bool(*IsLetterLegal)(char letter));
inline void ShowLetterIllegalError(HWND hwnd, bool(*IsLetterLegal)(char letter), bool balloon = true);
inline wchar_t* GetLetterIllegalErrMsg(bool(*IsLetterLegal)(char letter));
void ShowLetterIllegalBalloonTip(HWND hwnd, bool(*IsLetterLegal)(char letter));
inline void ShowLetterIllegalMessageBox(HWND hwnd, bool(*IsLetterLegal)(char letter));
inline bool IsInputLegal(bool(*IsLetterLegal)(char letter), char letter);
inline bool IsLetterLegalGG(char letter);
inline bool IsLetterLegalHex(char letter);
inline bool IsLetterLegalHexList(char letter);
inline bool IsLetterLegalCheat(char letter);
inline bool IsLetterLegalDec(char letter);
inline bool IsLetterLegalSize(char letter);
inline bool IsLetterLegalFloat(char letter);
inline bool IsLetterLegalDecHexMixed(char letter);
inline bool IsLetterLegalUnsignedDecHexMixed(char letter);
extern WNDPROC DefaultEditCtrlProc;
extern LRESULT APIENTRY FilterEditCtrlProc(HWND hDlg, UINT msg, WPARAM wP, LPARAM lP);

View File

@ -1373,7 +1373,7 @@ uint8 FCEU_ReadRomByte(uint32 i) {
void FCEU_WriteRomByte(uint32 i, uint8 value) {
if (i < 16)
#ifdef WIN32
MessageBox(hMemView, "Sorry", "You can't edit the ROM header.", MB_OK);
MessageBox(hMemView, "Sorry", "You can't edit the ROM header.", MB_OK | MB_ICONERROR);
#else
printf("Sorry, you can't edit the ROM header.\n");
#endif

View File

@ -895,8 +895,31 @@ int iNESLoad(const char *name, FCEUFILE *fp, int OverwriteVidMode) {
iNESCart.battery = (head.ROM_type & 2) ? 1 : 0;
iNESCart.mirror = Mirroring;
if (!iNES_Init(MapperNo))
int result = iNES_Init(MapperNo);
switch(result)
{
case 0:
goto init_ok;
case 1:
FCEU_PrintError("iNES mapper #%d is not supported at all.", MapperNo);
goto init_ok; // this error is still allowed to run as NROM?
case 2:
FCEU_PrintError("Unable to allocate CHR-RAM.");
break;
case 3:
FCEU_PrintError("CHR-RAM size < 1k is not supported.");
break;
}
if (ROM) free(ROM);
if (VROM) free(VROM);
if (trainerpoo) free(trainerpoo);
if (ExtraNTARAM) free(ExtraNTARAM);
ROM = NULL;
VROM = NULL;
trainerpoo = NULL;
ExtraNTARAM = NULL;
return 0;
init_ok:
GameInfo->mappernum = MapperNo;
FCEU_LoadGameSave(&iNESCart);
@ -1020,7 +1043,8 @@ static int iNES_Init(int num) {
{
CHRRAMSize = iNESCart.battery_vram_size + iNESCart.vram_size;
}
if ((VROM = (uint8*)FCEU_dmalloc(CHRRAMSize)) == NULL) return 0;
if (CHRRAMSize < 1024) return 3; // unsupported size, VPage only goes down to 1k banks, NES program can corrupt memory if used
if ((VROM = (uint8*)FCEU_dmalloc(CHRRAMSize)) == NULL) return 2;
FCEU_MemoryRand(VROM, CHRRAMSize);
UNIFchrrama = VROM;
@ -1040,9 +1064,9 @@ static int iNES_Init(int num) {
if (head.ROM_type & 8)
AddExState(ExtraNTARAM, 2048, 0, "EXNR");
tmp->init(&iNESCart);
return 1;
return 0;
}
tmp++;
}
return 0;
return 1;
}