* added "Clear" button to Message Log

* Taseditor: fixed sneaky Greenzone bug
This commit is contained in:
ansstuff 2012-08-22 16:19:13 +00:00
parent 9750ad4940
commit acfb5bf912
8 changed files with 39 additions and 14 deletions

View File

@ -4,7 +4,7 @@
static HWND logwin = 0; static HWND logwin = 0;
static char *logtext[MAXIMUM_NUMBER_OF_LOGS]; static char *logtext[MAXIMUM_NUMBER_OF_LOGS];
static unsigned int logcount=0; static int logcount=0;
int MLogPosX=0,MLogPosY=0; //X,Y coordinates of dialog int MLogPosX=0,MLogPosY=0; //X,Y coordinates of dialog
@ -20,7 +20,7 @@ unsigned int truncated_logcount()
void RedoText(void) void RedoText(void)
{ {
char textbuf[65536] = { 0 }; char textbuf[65536] = { 0 };
unsigned int x; int x;
int tbs=0; // textbuf size int tbs=0; // textbuf size
int cs; // current log size int cs; // current log size
@ -94,15 +94,22 @@ BOOL CALLBACK LogCon(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
} }
break; break;
case WM_COMMAND: case WM_COMMAND:
if(HIWORD(wParam)==BN_CLICKED) {
if (HIWORD(wParam) == BN_CLICKED)
{
if (LOWORD(wParam) == IDB_CLEAR_LOG)
{
ClearLog();
} else if (LOWORD(wParam) == IDB_CLOSE_LOG)
{ {
DestroyWindow(hwndDlg); DestroyWindow(hwndDlg);
// Clear the handle // Clear the handle
logwin = 0; logwin = 0;
} }
}
break; break;
} }
}
return 0; return 0;
} }
@ -116,9 +123,21 @@ void MakeLogWindow(void)
{ {
logwin = CreateDialog(fceu_hInstance, "MESSAGELOG" , 0, LogCon); logwin = CreateDialog(fceu_hInstance, "MESSAGELOG" , 0, LogCon);
RedoText(); // XXX jeblanchard Why didn't this work in WM_INITDIALOG? RedoText(); // XXX jeblanchard Why didn't this work in WM_INITDIALOG?
} else
{
SetFocus(logwin);
} }
} }
void ClearLog()
{
for (logcount--; logcount >= 0; logcount--)
free(logtext[truncated_logcount()]);
logcount = 0;
if (logwin)
RedoText();
}
/** /**
* Adds a textual log message to the message buffer. * Adds a textual log message to the message buffer.
* *

View File

@ -5,3 +5,4 @@
void MakeLogWindow(void); void MakeLogWindow(void);
void AddLogText(const char *text, unsigned int add_newline); void AddLogText(const char *text, unsigned int add_newline);
void ClearLog();

View File

@ -800,13 +800,14 @@ BEGIN
RTEXT "Filter:",65484,6,255,21,12,SS_CENTERIMAGE | NOT WS_GROUP RTEXT "Filter:",65484,6,255,21,12,SS_CENTERIMAGE | NOT WS_GROUP
END END
MESSAGELOG DIALOGEX 33, 38, 262, 237 MESSAGELOG DIALOGEX 33, 38, 262, 233
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Message Log" CAPTION "Message Log"
FONT 9, "Terminal", 0, 0, 0x0 FONT 9, "Terminal", 0, 0, 0x0
BEGIN BEGIN
DEFPUSHBUTTON "Close",1,224,220,34,14 EDITTEXT LBL_LOG_TEXT,3,3,255,208,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL
EDITTEXT LBL_LOG_TEXT,4,15,254,202,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL PUSHBUTTON "Clear",IDB_CLEAR_LOG,156,214,49,16
PUSHBUTTON "Close",IDB_CLOSE_LOG,209,214,49,16
END END
NETMOO DIALOGEX 44, 59, 365, 209 NETMOO DIALOGEX 44, 59, 365, 209
@ -1917,7 +1918,6 @@ BEGIN
"MESSAGELOG", DIALOG "MESSAGELOG", DIALOG
BEGIN BEGIN
BOTTOMMARGIN, 184
END END
"NETMOO", DIALOG "NETMOO", DIALOG

View File

@ -5,6 +5,9 @@
#define CLOSE_BUTTON 1 #define CLOSE_BUTTON 1
#define BUTTON_CLOSE 1 #define BUTTON_CLOSE 1
#define BTN_CLOSE 1 #define BTN_CLOSE 1
#define IDB_CLOSE_LOG 1
#define IDB_CLOSE_LOG2 2
#define IDB_CLEAR_LOG 2
#define MENU_OPEN_FILE 100 #define MENU_OPEN_FILE 100
#define EDIT_ROMS 100 #define EDIT_ROMS 100
#define LBL_LOG_TEXT 100 #define LBL_LOG_TEXT 100

View File

@ -183,7 +183,7 @@ public:
if(incr<256) if(incr<256)
{ {
//sanity check: should never be less than 256 //sanity check: should never be less than 256
printf("OHNO -- %d -- shouldnt be less than 256!\n",incr); FCEU_printf("OHNO -- %d -- shouldnt be less than 256!\n", incr);
} }
incr = (incr*scale)>>8; //apply scaling factor incr = (incr*scale)>>8; //apply scaling factor

View File

@ -416,7 +416,7 @@ void GREENZONE::InvalidateAndCheck(int after)
{ {
if (after >= currMovieData.getNumRecords()) if (after >= currMovieData.getNumRecords())
after = currMovieData.getNumRecords() - 1; after = currMovieData.getNumRecords() - 1;
if (greenZoneCount > after + 1) if (greenZoneCount > after + 1 || currFrameCounter > after)
{ {
// clear all savestates that became irrelevant // clear all savestates that became irrelevant
for (int i = greenZoneCount - 1; i > after; i--) for (int i = greenZoneCount - 1; i > after; i--)

View File

@ -233,6 +233,7 @@ void PLAYBACK::update()
lost_position_is_stable = false; lost_position_is_stable = false;
} }
// called after saving the project, because saving uses the progressbar for itself
void PLAYBACK::updateProgressbar() void PLAYBACK::updateProgressbar()
{ {
if (pause_frame) if (pause_frame)
@ -247,6 +248,7 @@ void PLAYBACK::updateProgressbar()
// cleared progressbar // cleared progressbar
SetProgressbar(0, 1); SetProgressbar(0, 1);
} }
RedrawWindow(hwndProgressbar, NULL, NULL, RDW_INVALIDATE);
} }
void PLAYBACK::ToggleEmulationPause() void PLAYBACK::ToggleEmulationPause()

View File

@ -292,7 +292,7 @@ void RecolorResizableSurface()
{ {
// fill the surface using BG color from PPU // fill the surface using BG color from PPU
unsigned char r, g, b; unsigned char r, g, b;
FCEUD_GetPalette(0x80 + PALRAM[0], &r, &g, &b); FCEUD_GetPalette(0x80 | PALRAM[0], &r, &g, &b);
blitfx.dwFillColor = (r << 16) + (g << 8) + b; blitfx.dwFillColor = (r << 16) + (g << 8) + b;
ddrval = IDirectDrawSurface7_Blt(lpDDSResizable, NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_ASYNC, &blitfx); ddrval = IDirectDrawSurface7_Blt(lpDDSResizable, NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_ASYNC, &blitfx);
} else } else