1. Experimental limit the input characters for some edit control.
2. Removed HWND pwindow, since it's ambiguous and not too much used. The pallete window use it's own global HWND variable.
This commit is contained in:
parent
9fd9841d6f
commit
cc31ee1a37
|
@ -29,8 +29,8 @@
|
|||
#include "../../cheat.h" // For FCEU_LoadGameCheats()
|
||||
#include <map>
|
||||
|
||||
static HWND pwindow = 0; //Handle to Cheats dialog
|
||||
HWND hCheat = 0; //mbg merge 7/19/06 had to add
|
||||
// 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
|
||||
HMENU hCheatcontext = 0; //Handle to cheat context menu
|
||||
|
||||
bool pauseWhileActive = false; //For checkbox "Pause while active"
|
||||
|
@ -68,10 +68,12 @@ int GGaddr, GGcomp, GGval;
|
|||
char GGcode[10];
|
||||
int GGlist[GGLISTSIZE];
|
||||
static int dontupdateGG; //this eliminates recursive crashing
|
||||
static char* ggLets = "APZLGITYEOXUKSVN";
|
||||
|
||||
// bool dodecode;
|
||||
|
||||
HWND hGGConv;
|
||||
WNDPROC DefaultGGConvWndProc;
|
||||
|
||||
void EncodeGG(char *str, int a, int v, int c);
|
||||
void ListGGAddresses();
|
||||
|
@ -946,7 +948,7 @@ void ConfigCheats(HWND hParent)
|
|||
selcheat = -1;
|
||||
CheatWindow = 1;
|
||||
if (CheatStyle)
|
||||
pwindow = hCheat = CreateDialog(fceu_hInstance, "CHEATCONSOLE", hParent, CheatConsoleCallB);
|
||||
hCheat = CreateDialog(fceu_hInstance, "CHEATCONSOLE", hParent, CheatConsoleCallB);
|
||||
else
|
||||
DialogBox(fceu_hInstance, "CHEATCONSOLE", hParent, CheatConsoleCallB);
|
||||
UpdateCheatsAdded();
|
||||
|
@ -960,10 +962,10 @@ void ConfigCheats(HWND hParent)
|
|||
|
||||
void UpdateCheatList()
|
||||
{
|
||||
if (!pwindow)
|
||||
if (!hCheat)
|
||||
return;
|
||||
else
|
||||
ShowResults(pwindow);
|
||||
ShowResults(hCheat);
|
||||
}
|
||||
|
||||
void UpdateCheatListGroupBoxUI()
|
||||
|
@ -1030,7 +1032,7 @@ BOOL CALLBACK GGConvCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
SendDlgItemMessage(hwndDlg, IDC_GAME_GENIE_COMP, EM_SETLIMITTEXT, 2, 0);
|
||||
SendDlgItemMessage(hwndDlg, IDC_GAME_GENIE_VAL, EM_SETLIMITTEXT, 2, 0);
|
||||
|
||||
|
||||
DefaultGGConvWndProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndDlg, IDC_GAME_GENIE_CODE), GWL_WNDPROC, (LONG)GGConvCustomWndProc);
|
||||
|
||||
break;
|
||||
case WM_CLOSE:
|
||||
|
@ -1130,12 +1132,111 @@ BOOL CALLBACK GGConvCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
LRESULT APIENTRY GGConvCustomWndProc(HWND hDlg, UINT msg, WPARAM wP, LPARAM lP)
|
||||
{
|
||||
bool through = true;
|
||||
LRESULT result = 0;
|
||||
|
||||
switch (msg)
|
||||
{
|
||||
case WM_PASTE:
|
||||
{
|
||||
switch (GetDlgCtrlID(GetFocus()))
|
||||
{
|
||||
case IDC_GAME_GENIE_CODE:
|
||||
printf("PASTE\n");
|
||||
if (OpenClipboard(hDlg))
|
||||
{
|
||||
HANDLE handle = GetClipboardData(CF_TEXT);
|
||||
if (handle)
|
||||
{
|
||||
|
||||
// copy the original clipboard string
|
||||
char* clipStr = (char*)GlobalLock(handle);
|
||||
char* original = (char*)calloc(1, strlen(clipStr) + 1);
|
||||
strcpy(original, clipStr);
|
||||
GlobalUnlock(handle);
|
||||
|
||||
// filter it out
|
||||
char filtered[9] = { 0 };
|
||||
int filteredIndex = 0, origIndex = 0;
|
||||
while (clipStr[origIndex] && filteredIndex < 9)
|
||||
{
|
||||
for (int i = 0; ggLets[i]; ++i)
|
||||
{
|
||||
if (toupper(clipStr[origIndex]) == ggLets[i])
|
||||
{
|
||||
filtered[filteredIndex] = clipStr[origIndex];
|
||||
++filteredIndex;
|
||||
}
|
||||
}
|
||||
++origIndex;
|
||||
}
|
||||
|
||||
// copy filtered str to clipboard
|
||||
EmptyClipboard();
|
||||
HANDLE hNewStr = GlobalAlloc(GMEM_MOVEABLE, 9);
|
||||
char* newStr = (char*)GlobalLock(hNewStr);
|
||||
strcpy(newStr, filtered);
|
||||
GlobalUnlock(hNewStr);
|
||||
SetClipboardData(CF_TEXT, hNewStr);
|
||||
|
||||
// end
|
||||
CloseClipboard();
|
||||
result = CallWindowProc(DefaultGGConvWndProc, hDlg, msg, wP, lP);
|
||||
through = false;
|
||||
|
||||
// set it back to normal
|
||||
if (OpenClipboard(hDlg))
|
||||
{
|
||||
handle = GetClipboardData(CF_TEXT);
|
||||
if (handle)
|
||||
{
|
||||
EmptyClipboard();
|
||||
HANDLE hOldStr = GlobalAlloc(GMEM_MOVEABLE, strlen(original) + 1);
|
||||
char* oldStr = (char*)GlobalLock(hOldStr);
|
||||
strcpy(oldStr, original);
|
||||
GlobalUnlock(hOldStr);
|
||||
SetClipboardData(CF_TEXT, hOldStr);
|
||||
}
|
||||
CloseClipboard();
|
||||
}
|
||||
|
||||
// end
|
||||
free(original);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WM_CHAR:
|
||||
{
|
||||
switch (GetDlgCtrlID(GetFocus()))
|
||||
{
|
||||
case IDC_GAME_GENIE_CODE:
|
||||
{
|
||||
through = wP == VK_BACK || GetKeyState(VK_CONTROL) & 0x8000;
|
||||
if (!through)
|
||||
for (int i = 0; ggLets[i]; ++i)
|
||||
if (toupper(wP) == ggLets[i])
|
||||
{
|
||||
through = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return through ? CallWindowProc(DefaultGGConvWndProc, hDlg, msg, wP, lP) : result;
|
||||
}
|
||||
|
||||
//The code in this function is a modified version
|
||||
//of Chris Covell's work - I'd just like to point that out
|
||||
void EncodeGG(char *str, int a, int v, int c)
|
||||
{
|
||||
uint8 num[8];
|
||||
static char lets[16]={'A','P','Z','L','G','I','T','Y','E','O','X','U','K','S','V','N'};
|
||||
int i;
|
||||
|
||||
a&=0x7fff;
|
||||
|
@ -1149,14 +1250,14 @@ void EncodeGG(char *str, int a, int v, int c)
|
|||
|
||||
if (c == -1){
|
||||
num[5]+=v&8;
|
||||
for(i = 0;i < 6;i++)str[i] = lets[num[i]];
|
||||
for(i = 0;i < 6;i++)str[i] = ggLets[num[i]];
|
||||
str[6] = 0;
|
||||
} else {
|
||||
num[2]+=8;
|
||||
num[5]+=c&8;
|
||||
num[6]=(c&7)+((c>>4)&8);
|
||||
num[7]=((c>>4)&7)+(v&8);
|
||||
for(i = 0;i < 8;i++)str[i] = lets[num[i]];
|
||||
for(i = 0;i < 8;i++)str[i] = ggLets[num[i]];
|
||||
str[8] = 0;
|
||||
}
|
||||
return;
|
||||
|
|
|
@ -34,6 +34,11 @@ void SaveCheatAs(HWND hwnd, bool flush = false);
|
|||
void UpdateCheatRelatedWindow();
|
||||
extern POINT CalcSubWindowPos(HWND hDlg, POINT* conf);
|
||||
|
||||
extern BOOL CALLBACK GGConvCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
extern WNDPROC DefaultGGConvWndProc;
|
||||
extern LRESULT APIENTRY GGConvCustomWndProc(HWND hDlg, UINT msg, WPARAM wP, LPARAM lP);
|
||||
|
||||
|
||||
// deselect the old one and select the new one
|
||||
#define ListView_MoveSelectionMark(hwnd, prevIndex, newIndex) \
|
||||
LVITEM lvi; \
|
||||
|
@ -47,4 +52,5 @@ SetDlgItemText(hwnd, IDC_CHEAT_VAL, (LPTSTR)"") & \
|
|||
SetDlgItemText(hwnd, IDC_CHEAT_COM, (LPTSTR)"") & \
|
||||
SetDlgItemText(hwnd, IDC_CHEAT_NAME, (LPTSTR)"") & \
|
||||
SetDlgItemText(hwnd, IDC_CHEAT_TEXT, (LPTSTR)""))
|
||||
|
||||
#endif
|
|
@ -321,41 +321,37 @@ int BlockingCheck()
|
|||
if(GetMessage(&msg, 0, 0, 0) > 0)
|
||||
{
|
||||
//other accelerator capable dialogs could be added here
|
||||
extern HWND hwndMemWatch;
|
||||
|
||||
int handled = 0;
|
||||
|
||||
extern HWND hGGConv;
|
||||
bool debug = IsChild(hGGConv, msg.hwnd) && msg.message == WM_KEYDOWN;
|
||||
|
||||
// Cheat console
|
||||
if(hCheat && IsChild(hCheat, msg.hwnd))
|
||||
handled = IsDialogMessage(hCheat, &msg);
|
||||
|
||||
// Hex Editor -> Find
|
||||
if(!handled && hMemFind && IsChild(hMemFind, msg.hwnd))
|
||||
handled = IsDialogMessage(hMemFind, &msg);
|
||||
|
||||
// Memory Watch
|
||||
extern HWND hwndMemWatch;
|
||||
if(!handled && hwndMemWatch)
|
||||
{
|
||||
if(IsChild(hwndMemWatch,msg.hwnd))
|
||||
handled = TranslateAccelerator(hwndMemWatch,fceu_hAccel,&msg);
|
||||
if(IsChild(hwndMemWatch, msg.hwnd))
|
||||
handled = TranslateAccelerator(hwndMemWatch, fceu_hAccel, &msg);
|
||||
if(!handled)
|
||||
handled = IsDialogMessage(hwndMemWatch,&msg);
|
||||
}
|
||||
|
||||
if (debug && !handled) printf("GGConv unhandled WM_KEYDOWN: %d\n", 3);
|
||||
|
||||
// RAM Search
|
||||
if(!handled && RamSearchHWnd && IsChild(RamSearchHWnd, msg.hwnd))
|
||||
handled = IsDialogMessage(RamSearchHWnd, &msg);
|
||||
|
||||
if (debug && !handled) printf("GGConv unhandled WM_KEYDOWN: %d\n", 4);
|
||||
|
||||
// RAM_Watch
|
||||
if(!handled && RamWatchHWnd)
|
||||
if(handled = IsDialogMessage(RamWatchHWnd, &msg))
|
||||
if(msg.message == WM_KEYDOWN) // send keydown messages to the dialog (for accelerators, and also needed for the Alt key to work)
|
||||
SendMessage(RamWatchHWnd, msg.message, msg.wParam, msg.lParam);
|
||||
|
||||
if (debug && !handled) printf("GGConv unhandled WM_KEYDOWN: %d\n", 5);
|
||||
|
||||
// TAS Editor
|
||||
if(!handled && taseditorWindow.hwndTASEditor)
|
||||
{
|
||||
if(taseditorEnableAcceleratorKeys)
|
||||
|
@ -366,84 +362,71 @@ int BlockingCheck()
|
|||
}
|
||||
}
|
||||
|
||||
if (debug && !handled) printf("GGConv unhandled WM_KEYDOWN: %d\n", 6);
|
||||
|
||||
// TAS Editor -> Find Node
|
||||
if(!handled && taseditorWindow.hwndFindNote && IsChild(taseditorWindow.hwndFindNote, msg.hwnd))
|
||||
handled = IsDialogMessage(taseditorWindow.hwndFindNote, &msg);
|
||||
|
||||
if (debug && !handled) printf("GGConv unhandled WM_KEYDOWN: %d\n", 7);
|
||||
|
||||
// Sound Config
|
||||
extern HWND uug;
|
||||
if(!handled && uug && IsChild(uug, msg.hwnd))
|
||||
handled = IsDialogMessage(uug, &msg);
|
||||
|
||||
if (debug && !handled) printf("GGConv unhandled WM_KEYDOWN: %d\n", 8);
|
||||
|
||||
if(!handled && pwindow && IsChild(pwindow, msg.hwnd))
|
||||
handled = IsDialogMessage(pwindow, &msg);
|
||||
|
||||
if (debug && !handled) printf("GGConv unhandled WM_KEYDOWN: %d\n", 9);
|
||||
// Palette Config
|
||||
extern HWND hWndPal;
|
||||
if(!handled && hWndPal && IsChild(hWndPal, msg.hwnd))
|
||||
handled = IsDialogMessage(hWndPal, &msg);
|
||||
|
||||
// Code/Data Logger
|
||||
if(!handled && hCDLogger && IsChild(hCDLogger, msg.hwnd))
|
||||
handled = IsDialogMessage(hCDLogger, &msg);
|
||||
|
||||
if (debug && !handled) printf("GGConv unhandled WM_KEYDOWN: %d\n", 10);
|
||||
|
||||
// Trace Logger
|
||||
if(!handled && hTracer && IsChild(hTracer, msg.hwnd))
|
||||
handled = IsDialogMessage(hTracer, &msg);
|
||||
|
||||
if (debug && !handled)
|
||||
printf("GGConv unhandled WM_KEYDOWN: %d\n", 11);
|
||||
|
||||
// Game Genie Encoder/Decoder
|
||||
extern HWND hGGConv;
|
||||
if(!handled && hGGConv && IsChild(hGGConv, msg.hwnd))
|
||||
handled = IsDialogMessage(hGGConv, &msg);
|
||||
|
||||
if (debug)
|
||||
if(!handled)
|
||||
printf("GGConv unhandled WM_KEYDOWN: %d\n", 12);
|
||||
else
|
||||
printf("GGConv handled\n");
|
||||
|
||||
// Debugger
|
||||
if(!handled && hDebug && IsChild(hDebug, msg.hwnd))
|
||||
handled = IsDialogMessage(hDebug, &msg);
|
||||
|
||||
if (debug && !handled) printf("GGConv unhandled WM_KEYDOWN: %d\n", 13);
|
||||
|
||||
// PPU Viewer
|
||||
extern HWND hPPUView;
|
||||
if(!handled && hPPUView && IsChild(hPPUView, msg.hwnd))
|
||||
handled = IsDialogMessage(hPPUView, &msg);
|
||||
|
||||
if (debug && !handled) printf("GGConv unhandled WM_KEYDOWN: %d\n", 14);
|
||||
|
||||
// Nametable Viewer
|
||||
extern HWND hNTView;
|
||||
if(!handled && hNTView && IsChild(hNTView, msg.hwnd))
|
||||
handled = IsDialogMessage(hNTView, &msg);
|
||||
|
||||
if (debug && !handled) printf("GGConv unhandled WM_KEYDOWN: %d\n", 15);
|
||||
|
||||
// Text Hooker
|
||||
extern HWND hTextHooker;
|
||||
if(!handled && hTextHooker && IsChild(hTextHooker, msg.hwnd))
|
||||
handled = IsDialogMessage(hTextHooker, &msg);
|
||||
|
||||
if (debug && !handled) printf("GGConv unhandled WM_KEYDOWN: %d\n", 16);
|
||||
|
||||
// Lua Scripts
|
||||
extern HWND LuaConsoleHWnd;
|
||||
if(!handled && LuaConsoleHWnd && IsChild(LuaConsoleHWnd, msg.hwnd))
|
||||
handled = IsDialogMessage(LuaConsoleHWnd, &msg);
|
||||
|
||||
if (debug && !handled) printf("GGConv unhandled WM_KEYDOWN: %d\n", 17);
|
||||
|
||||
// Logs
|
||||
extern HWND logwin;
|
||||
if(!handled && logwin && IsChild(logwin, msg.hwnd))
|
||||
handled = IsDialogMessage(logwin, &msg);
|
||||
|
||||
if (debug && !handled) printf("GGConv unhandled WM_KEYDOWN: %d\n", 18);
|
||||
|
||||
// Header Editor
|
||||
extern HWND hHeadEditor;
|
||||
if (!handled && hHeadEditor && IsChild(hHeadEditor, msg.hwnd))
|
||||
handled = IsDialogMessage(hHeadEditor, &msg);
|
||||
|
||||
if (debug && !handled) printf("GGConv unhandled WM_KEYDOWN: %d\n", 19);
|
||||
// Netplay (Though it's quite dummy and nearly forgotten)
|
||||
extern HWND netwin;
|
||||
if (!handled && netwin && IsChild(netwin, msg.hwnd))
|
||||
handled = IsDialogMessage(netwin, &msg);
|
||||
|
||||
/* //adelikat - Currently no accel keys are used in the main window. Uncomment this block to activate them.
|
||||
if(!handled)
|
||||
|
@ -456,10 +439,9 @@ int BlockingCheck()
|
|||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if(!handled)
|
||||
{
|
||||
if (debug && !handled) printf("GGConv unhandled WM_KEYDOWN: %d\n", 20);
|
||||
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
static int recv_tcpwrap(uint8 *buf, int len);
|
||||
static void NetStatAdd(char *text);
|
||||
|
||||
static HWND netwin=0;
|
||||
HWND netwin=0;
|
||||
|
||||
static char *netstatt[64];
|
||||
static int netstattcount=0;
|
||||
|
|
|
@ -12,6 +12,7 @@ extern int palsharpness;
|
|||
extern int palcontrast;
|
||||
extern int palbrightness;
|
||||
extern bool paldeemphswap;
|
||||
HWND hWndPal = NULL;
|
||||
|
||||
bool SetPalette(const char* nameo)
|
||||
{
|
||||
|
@ -226,7 +227,7 @@ BOOL CALLBACK PaletteConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||
case BUTTON_CLOSE:
|
||||
gornk:
|
||||
DestroyWindow(hwndDlg);
|
||||
pwindow = 0; // Yay for user race conditions.
|
||||
hWndPal = 0; // Yay for user race conditions.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -240,13 +241,9 @@ gornk:
|
|||
**/
|
||||
void ConfigPalette()
|
||||
{
|
||||
if(!pwindow)
|
||||
{
|
||||
pwindow=CreateDialog(fceu_hInstance, "PALCONFIG" ,0 , PaletteConCallB);
|
||||
}
|
||||
if(!hWndPal)
|
||||
hWndPal = CreateDialog(fceu_hInstance, "PALCONFIG", hAppWnd, PaletteConCallB);
|
||||
else
|
||||
{
|
||||
SetFocus(pwindow);
|
||||
}
|
||||
SetFocus(hWndPal);
|
||||
}
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ using namespace std;
|
|||
|
||||
//Handles----------------------------------------------
|
||||
static HMENU fceumenu = 0; //Main menu.
|
||||
HWND pwindow; //Client Area
|
||||
// HWND pwindow; //Client Area
|
||||
HMENU recentmenu; //Recent Menu
|
||||
HMENU recentluamenu; //Recent Lua Files Menu
|
||||
HMENU recentmoviemenu; //Recent Movie Files Menu
|
||||
|
|
|
@ -19,7 +19,7 @@ struct CreateMovieParameters
|
|||
extern char *recent_files[];
|
||||
extern char *recent_lua[];
|
||||
extern char *recent_movie[];
|
||||
extern HWND pwindow;
|
||||
// extern HWND pwindow;
|
||||
|
||||
HWND GetMainHWND();
|
||||
|
||||
|
|
|
@ -1117,8 +1117,8 @@ static void LaunchCodeDataLogger(void)
|
|||
static void LaunchCheats(void)
|
||||
{
|
||||
#ifdef WIN32
|
||||
extern HWND pwindow;
|
||||
ConfigCheats(pwindow);
|
||||
extern HWND hCheat;
|
||||
ConfigCheats(hCheat);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -1500,8 +1500,7 @@ bool FCEUMOV_ReadState(EMUFILE* is, uint32 size)
|
|||
//mbg 8/18/08 - this code can be used to turn the error message into an OK/CANCEL
|
||||
#ifdef WIN32
|
||||
std::string msg = "There is a mismatch between savestate's movie and current movie.\ncurrent: " + currMovieData.guid.toString() + "\nsavestate: " + tempMovieData.guid.toString() + "\n\nThis means that you have loaded a savestate belonging to a different movie than the one you are playing now.\n\nContinue loading this savestate anyway?";
|
||||
extern HWND pwindow;
|
||||
int result = MessageBox(pwindow,msg.c_str(),"Error loading savestate",MB_OKCANCEL);
|
||||
int result = MessageBox(hAppWnd, msg.c_str(), "Error loading savestate", MB_OKCANCEL);
|
||||
if(result == IDCANCEL)
|
||||
{
|
||||
if (!backupSavestates) //If backups are disabled we can just resume normally since we can't restore so stop movie and inform user
|
||||
|
|
Loading…
Reference in New Issue