Win32 - 1) prevent user from freezing more than 256 addresses, 2) Memwatch will display frozen addresses in blue, 3) Memwatch - menu item for collapse window
This commit is contained in:
parent
96609ff799
commit
7148bf9de2
|
@ -1,4 +1,5 @@
|
|||
---version 2.0.4 yet to be released---
|
||||
14-dec-2008 - adelikat - win32 - memwatch - frozen addresses will display as blue
|
||||
14-dec-2008 - adelikat - win32 - hexeditor - prevent the user from freezing more than 256 addresses at once
|
||||
14-dec-2008 - adelikat - win32 - memwatch - collapsable to 1 column
|
||||
08-dec-2008 - adelikat - win32 - stop lua menu item gray if no lua script is running
|
||||
|
|
|
@ -33,8 +33,14 @@
|
|||
#include "memory.h"
|
||||
#include "driver.h"
|
||||
|
||||
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)
|
||||
{
|
||||
int x;
|
||||
|
@ -111,7 +117,6 @@ void RebuildSubCheats(void)
|
|||
{
|
||||
int x;
|
||||
struct CHEATF *c=cheats;
|
||||
FCEU_DispMessage("Numcheats: %d",numsubcheats);
|
||||
for(x=0;x<numsubcheats;x++)
|
||||
SetReadHandler(SubCheats[x].addr,SubCheats[x].addr,SubCheats[x].PrevRead);
|
||||
|
||||
|
@ -137,6 +142,7 @@ void RebuildSubCheats(void)
|
|||
}
|
||||
c=c->next;
|
||||
}
|
||||
FrozenAddressCount = numsubcheats; //Update the frozen address list
|
||||
}
|
||||
|
||||
void FCEU_PowerCheats()
|
||||
|
@ -369,6 +375,7 @@ int FCEUI_AddCheat(const char *name, uint32 addr, uint8 val, int compare, int ty
|
|||
}
|
||||
savecheats=1;
|
||||
RebuildSubCheats();
|
||||
UpdateFrozenList();
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
@ -414,7 +421,7 @@ int FCEUI_DelCheat(uint32 which)
|
|||
|
||||
savecheats=1;
|
||||
RebuildSubCheats();
|
||||
|
||||
UpdateFrozenList();
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
@ -926,3 +933,19 @@ void FCEU_CheatSetByte(uint32 A, uint8 V)
|
|||
else if(A < 0x10000)
|
||||
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.
|
||||
|
||||
int 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",FrozenAddressCount);//Debug
|
||||
}
|
|
@ -9,4 +9,7 @@ void ConfigCheats(HWND hParent);
|
|||
void DoGGConv();
|
||||
void SetGGConvFocus(int address,int compare);
|
||||
void UpdateCheatList();
|
||||
|
||||
extern unsigned int FrozenAddressCount;
|
||||
extern std::vector<uint16> FrozenAddresses;
|
||||
//void ConfigAddCheat(HWND wnd); //bbit edited:commented out this line
|
||||
|
|
|
@ -577,7 +577,8 @@ void dumpToFile(const char* buffer, unsigned int size)
|
|||
void FreezeRam(int address, int mode, int final){
|
||||
// mode: -1 == Unfreeze; 0 == Toggle; 1 == Freeze
|
||||
// ################################## End of SP CODE ###########################
|
||||
if((address < 0x2000) || ((address >= 0x6000) && (address <= 0x7FFF))){
|
||||
if(FrozenAddressCount <= 256 && (address < 0x2000) || ((address >= 0x6000) && (address <= 0x7FFF))){
|
||||
//adelikat: added FrozenAddressCount check to if statement to prevent user from freezing more than 256 address (unfreezing when > 256 crashes)
|
||||
addrtodelete = address;
|
||||
cheatwasdeleted = 0;
|
||||
|
||||
|
@ -841,6 +842,7 @@ LRESULT CALLBACK MemViewCallB(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||
TEXTMETRIC tm;
|
||||
SCROLLINFO si;
|
||||
int x, y, i, j;
|
||||
int tempAddy;
|
||||
|
||||
const int MemFontWidth = debugSystem->fixedFontWidth;
|
||||
const int MemFontHeight = debugSystem->fixedFontHeight;
|
||||
|
@ -1106,9 +1108,11 @@ LRESULT CALLBACK MemViewCallB(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||
AppendMenu(sub, MF_STRING, ID_ADDRESS_FRZ_UNFREEZE, "Unfreeze");
|
||||
AppendMenu(sub, MF_SEPARATOR, ID_ADDRESS_FRZ_SEP, "-");
|
||||
AppendMenu(sub, MF_STRING, ID_ADDRESS_FRZ_UNFREEZE_ALL, "Unfreeze all");
|
||||
|
||||
if (CursorEndAddy - CursorStartAddy > 256) //There is a limit of 256 possible frozen addresses, therefore if the user has selected more than this limit, disable freeze menu items
|
||||
{
|
||||
|
||||
if (CursorEndAddy == -1) tempAddy = CursorStartAddy;
|
||||
else tempAddy = CursorEndAddy; //This is necessary because CursorEnd = -1 if only 1 address is selected
|
||||
if (tempAddy - CursorStartAddy + FrozenAddressCount > 255) //There is a limit of 256 possible frozen addresses, therefore if the user has selected more than this limit, disable freeze menu items
|
||||
{
|
||||
EnableMenuItem(sub,ID_ADDRESS_FRZ_TOGGLE_STATE,MF_GRAYED);
|
||||
EnableMenuItem(sub,ID_ADDRESS_FRZ_FREEZE,MF_GRAYED);
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "memwatch.h"
|
||||
#include "../../debug.h"
|
||||
#include "debugger.h"
|
||||
#include "cheat.h"
|
||||
#include "../../utils/xstring.h"
|
||||
#include "help.h"
|
||||
#include <string>
|
||||
|
@ -270,6 +271,15 @@ void UpdateMemWatch()
|
|||
{
|
||||
MWRec& mwrec = mwrecs[i];
|
||||
|
||||
//Display blue if address is frozen
|
||||
for (unsigned int x = 0; x < FrozenAddressCount; x++)
|
||||
{
|
||||
if (mwrec.addr == FrozenAddresses[x])
|
||||
{
|
||||
SetTextColor(hdc,RGB(0,0,255));
|
||||
}
|
||||
}
|
||||
|
||||
char* text;
|
||||
if(mwrec.valid && GameInfo)
|
||||
{
|
||||
|
@ -308,6 +318,7 @@ void UpdateMemWatch()
|
|||
|
||||
MoveToEx(hdc,xPositions[i],yPositions[i],NULL);
|
||||
TextOut(hdc,0,0,text,strlen(text));
|
||||
SetTextColor(hdc,RGB(0,0,0));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -793,6 +804,7 @@ static BOOL CALLBACK MemWatchCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
|
|||
OpenHelpWindow(memwhelp);
|
||||
break;
|
||||
|
||||
case MEMW_OPTIONS_EXPANDCOLLAPSE:
|
||||
case MEMW_EXPANDCOLLAPSE:
|
||||
CollapseWindow();
|
||||
break;
|
||||
|
@ -1020,11 +1032,21 @@ void RamChangeReset(int x)
|
|||
SetDlgItemText(hwndMemWatch, EDIT00_RESULTS+x, editchangem[x]); //Display text in results box
|
||||
}
|
||||
|
||||
void ChangeMemwMenuItemText(int menuitem, string text)
|
||||
{
|
||||
MENUITEMINFO moo;
|
||||
moo.cbSize = sizeof(moo);
|
||||
moo.fMask = MIIM_TYPE;
|
||||
moo.cch = NULL;
|
||||
GetMenuItemInfo(memwmenu, menuitem, FALSE, &moo);
|
||||
moo.dwTypeData = (LPSTR)text.c_str();
|
||||
SetMenuItemInfo(memwmenu, menuitem, FALSE, &moo);
|
||||
}
|
||||
|
||||
void CollapseWindow(void)
|
||||
{
|
||||
RECT wrect;
|
||||
int left,right,top,bottom;
|
||||
|
||||
|
||||
GetWindowRect(hwndMemWatch,&wrect); //Get currect window size
|
||||
|
||||
if (!MemWCollapsed) //If window is full size collapse it
|
||||
|
@ -1032,13 +1054,17 @@ void CollapseWindow(void)
|
|||
wrect.right = (wrect.right - ((wrect.right-wrect.left)/2));
|
||||
MemWCollapsed = true;
|
||||
SetDlgItemText(hwndMemWatch, MEMW_EXPANDCOLLAPSE, ">"); //Put Address value
|
||||
ChangeMemwMenuItemText(MEMW_OPTIONS_EXPANDCOLLAPSE, "Expand to 2 columns");
|
||||
}
|
||||
else
|
||||
{
|
||||
wrect.right = (wrect.right + (wrect.right-wrect.left));
|
||||
MemWCollapsed = false;
|
||||
SetDlgItemText(hwndMemWatch, MEMW_EXPANDCOLLAPSE, "<"); //Put Address value
|
||||
ChangeMemwMenuItemText(MEMW_OPTIONS_EXPANDCOLLAPSE, "Collapse to 1 column");
|
||||
}
|
||||
|
||||
|
||||
SetWindowPos(hwndMemWatch,HWND_TOPMOST,MemWatch_wndx,MemWatch_wndy,(wrect.right-wrect.left),(wrect.bottom-wrect.top),SWP_SHOWWINDOW);
|
||||
|
||||
|
||||
}
|
|
@ -291,6 +291,8 @@ BEGIN
|
|||
BEGIN
|
||||
MENUITEM "Load on Startup", MEMW_OPTIONS_LOADSTART
|
||||
MENUITEM "Load Last File on Startup", MEMW_OPTIONS_LOADLASTFILE
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Collapse to 1 column", MEMW_OPTIONS_EXPANDCOLLAPSE
|
||||
END
|
||||
POPUP "Help"
|
||||
BEGIN
|
||||
|
|
|
@ -621,6 +621,8 @@
|
|||
#define ID_GAME_VIEWCOMMENTSSUBTITLES 40310
|
||||
#define FCEUX_CONTEXT_VIEWCOMMENTSSUBTITLES 40311
|
||||
#define ID_GAME_VIEWCOMMENTSSUBTITLES40312 40312
|
||||
#define ID_OPTIONS_COLLAPSETO1COLUMN 40313
|
||||
#define MEMW_OPTIONS_EXPANDCOLLAPSE 40314
|
||||
#define IDC_DEBUGGER_ICONTRAY 55535
|
||||
#define MW_ValueLabel2 65423
|
||||
#define MW_ValueLabel1 65426
|
||||
|
@ -630,7 +632,7 @@
|
|||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 125
|
||||
#define _APS_NEXT_COMMAND_VALUE 40313
|
||||
#define _APS_NEXT_COMMAND_VALUE 40315
|
||||
#define _APS_NEXT_CONTROL_VALUE 1191
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue