1st pass at restoring debugger snap functionality

This commit is contained in:
zeromus 2008-08-07 03:59:19 +00:00
parent e14da467ee
commit 685c32af88
6 changed files with 23 additions and 366 deletions

View File

@ -427,7 +427,6 @@ BOOL CALLBACK CheatConsoleCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
case LBN_DBLCLK:
switch (LOWORD(wParam)) { //disable/enable cheat
case IDC_CHEAT_LIST_POSSIBILITIES:
extern int EmulationPaused;
if (EmulationPaused == 1) //We only want to send info to memwatch if paused
{ //otherwise we will be sending info while it is updating causing unpredictable behavior
lbfocus=1;

View File

@ -486,6 +486,9 @@ void UpdateDebugger()
if(!hDebug)
return;
//but if the debugger IS visible, then focus it
SetActiveWindow(hDebug);
char str[256]={0},chr[8];
int tmp,ret,i;

View File

@ -594,12 +594,10 @@ int main(int argc,char *argv[])
FCEUI_SetSoundVolume(soundvolume);
FCEUI_SetSoundQuality(soundquality);
}
ParseGIInput(NULL); /* Since a game doesn't have to be
loaded before the GUI can be used, make
sure the temporary input type variables
are set.
*/
//Since a game doesn't have to be loaded before the GUI can be used, make
//sure the temporary input type variables are set.
ParseGIInput(NULL);
// Initialize default directories
CreateDirs();
@ -697,45 +695,7 @@ doloopy:
return(0);
}
//mbg merge 7/19/06
//--------this code was added by tasbuild
//it catches a paused condition and
/*static int stopCount=0;
if(FCEUI_EmulationPaused() & 1)
{
if(stopCount==0)
_updateMemWatch();
stopCount++;
if(stopCount > 8)
{
StopSound();
stopCount = 0;
}
//if in bot mode, don't idle. eat the CPU up :)
//mbg - why should we do this? does bot mode set the paused flag? that doesnt seem right...
if(FCEU_BotMode() == BOTMODE_OFF)
{
int notAlternateThrottle = !(soundoptions&SO_OLDUP) && soundo && ((NoWaiting&1)?(256*16):fps_scale) >= 64;
if(notAlternateThrottle)
Sleep(5); // HACK to fix 100% CPU usage that happens sporadically when paused in background - also, this affects the repeat rate of frame advance and its sound quality
else
Sleep(1); // lesser, so frame advance repeat doesn't take too long with the alternate throttling
}
else if(stopCount == 1)
{
Sleep(0);
}
}
else
{
//_updateMemWatch();
stopCount=0;
}*/
//-----------------------------------
//mbg merge 7/19/06 - the function that contains the code that used to just be UpdateFCEUWindow() and FCEUD_UpdateInput()
void _updateWindow()
@ -751,208 +711,6 @@ void _updateWindow()
UpdateTasEdit();
}
//void FCEUD_Update(uint8 *XBuf, int32 *Buffer, int Count)
//{
// static int skipcount = 0;
// int temp_fps_scale=(NoWaiting&1)?(256*16):fps_scale;
// int maxskip = (temp_fps_scale<=256) ? 0 : temp_fps_scale>>8;
//
// int ocount = Count;
// // apply frame scaling to Count
// Count = (Count<<8)/temp_fps_scale;
//
// //Disable sound and throttling for BotMode--we want max speed!
// if(FCEU_BotMode() != BOTMODE_OFF)
// {
// if(XBuf && (skipcount >= 64))
// {
// skipcount = 0;
// FCEUD_BlitScreen(XBuf);
// }
// else
// {
// skipcount++;
// }
// UpdateFCEUWindow();
// FCEUD_UpdateInput();
// return;
// }
//
// if(!(soundoptions&SO_OLDUP) && soundo && temp_fps_scale >= 64)
// {
// // sounds better with FPS scaling, and is much less code than the other version...
//
// int32 writeSize = GetWriteSound();
// int32 writeCount = Count;
///*
// // prevents delay when exiting fast-forward
// if((NoWaiting&1) && writeCount>writeSize)
// writeCount=writeSize;
//*/
//
// if(Buffer && (writeCount))
// FCEUD_WriteSoundData(Buffer,temp_fps_scale,MAX(writeSize,writeCount));
//
// if(XBuf && (skipcount >= maxskip))
// {
// skipcount = 0;
// FCEUD_BlitScreen(XBuf);
// _updateMemWatch();
// }
// else
// skipcount++;
//
// _updateWindow();
// }
// else
// {
// // I don't understand this code, so I kept it around as an option ("old sound update")
// // in case it's doing something clever and necessary that I can't fathom
// // (oops, also it seems to be important for speeds <25% so it's always used then)
//
// const int soundScale = !(soundoptions&SO_OLDUP) ? temp_fps_scale : 256;
//
// if(Count)
// {
// int32 can=GetWriteSound();
// static int uflow=0;
// int32 tmpcan;
// extern int FCEUDnetplay;
//
// // don't underflow when scaling fps
// if(can >= GetMaxSound() && fps_scale<=256) uflow=1; // Go into massive underflow mode.
//
// if(can > Count) can=Count;
// else uflow=0;
//
// FCEUD_WriteSoundData(Buffer,soundScale,can);
//
// tmpcan = GetWriteSound();
// // don't underflow when scaling fps
// if(fps_scale>256 || ((tmpcan < Count*0.90) && !uflow) || (skipcount >= maxskip))
// {
// if(XBuf && (skipcount >= maxskip))
// {
// skipcount = 0;
// FCEUD_BlitScreen(XBuf);
// _updateMemWatch();
// }
// else
// {
// skipcount++;
// //FCEU_printf("Skipped0");
// // FCEU_PrintError("Skipped0");
// }
// Buffer+=can;
// Count-=can;
// if(Count)
// {
// if(NoWaiting)
// {
// can=GetWriteSound();
// if(Count>can) Count=can;
// FCEUD_WriteSoundData(Buffer,soundScale,Count);
// }
// else
// {
// int cnum=0;
// extern int silencer;
// while(Count>0)
// {
// FCEUD_WriteSoundData(Buffer,soundScale,(Count<ocount) ? Count : ocount);
// if(!(soundoptions&SO_OLDUP))
// {
// cnum++;
// if(cnum>2)
// silencer=1;
// }
// Count -= ocount;
// // prevent long updates from interfering with gui responsiveness:
//
// //mbg merge 7/19/06
// //UpdateFCEUWindow();
// //FCEUD_UpdateInput();
// _updateWindow();
// }
// silencer=0;
// }
// }
// }
// else
// {
// skipcount++;
// //FCEU_printf("Skipped");
//#ifdef NETWORK
// if(!NoWaiting && FCEUDnetplay && (uflow || tmpcan >= (Count * 0.90)))
// {
// if(Count > tmpcan) Count=tmpcan;
// while(tmpcan > 0)
// {
// //printf("Overwrite: %d\n", (Count <= tmpcan)?Count : tmpcan);
// FCEUD_WriteSoundData(Buffer,soundScale,(Count <= tmpcan)?Count : tmpcan);
// tmpcan -= Count;
// }
// }
//#endif
// }
// }
// else
// {
// /* This complex statement deserves some explanation.
// Make sure this special speed throttling hasn't been disabled by the user
// first. Second, we don't want to throttle the speed if the fast-forward
// button is pressed down(or during certain network play conditions).
//
// Now, if we're at this point, we'll throttle speed if sound is disabled.
// Otherwise, it gets a bit more complicated. We'll throttle speed if focus
// to FCE Ultra has been lost and we're writing to the primary sound buffer
// because our sound code won't block. Blocking does seem to work when
// writing to a secondary buffer, so we won't throttle when a secondary
// buffer is used.
// */
//
// //doagain: //mbg merge 6/30/06
//
// int skipthis = 0;
//
// if(!(eoptions&EO_NOTHROTTLE) || fps_scale != 256)
// if(!NoWaiting)
// if(!soundo || (soundo && nofocus && !(soundoptions&SO_SECONDARY)) || FCEUI_EmulationPaused() )
// skipthis = SpeedThrottle();
//
// if(XBuf)
// {
// if((!skipthis && !NoWaiting) || (skipcount >= maxskip))
// {
// FCEUD_BlitScreen(XBuf);
// _updateMemWatch();
// skipcount = 0;
// }
// else
// {
// skipcount++;
// }
// }
//
// //mbg merge 7/19/06 - since tasbuild we have code in main that attempts to do stuff like this
// //mbg merge 6/30/06
// //if(FCEUI_EmulationPaused())
// //{
// // StopSound();
// // Sleep(50);
// // BlockingCheck();
// // goto doagain;
// //}
// }
//
// //mbg merge 7/19/06
// //UpdateFCEUWindow();
// //FCEUD_UpdateInput();
// _updateWindow();
//
// } // end of !(old sound code) block
//}
void win_debuggerLoop()
{
//delay until something causes us to unpause.
@ -1028,112 +786,8 @@ void FCEUD_Update(uint8 *XBuf, int32 *Buffer, int Count)
FCEUD_UpdateInput();
// if(soundo) //&& temp_fps_scale >= 64
// {
// // sounds better with FPS scaling, and is much less code than the other version...
//
// int32 writeSize = GetWriteSound();
// int32 writeCount = Count;
///*
// // prevents delay when exiting fast-forward
// if((NoWaiting&1) && writeCount>writeSize)
// writeCount=writeSize;
//*/
//
// if(Buffer && (writeCount))
// FCEUD_WriteSoundData(Buffer,temp_fps_scale,MAX(writeSize,writeCount));
//
// if(XBuf && (BotFramesSkipped >= maxskip))
// {
// BotFramesSkipped = 0;
// FCEUD_BlitScreen(XBuf);
// _updateMemWatch();
// }
// else
// BotFramesSkipped++;
//
// _updateWindow();
// }
//#ifdef NETWORK
// if(!NoWaiting && FCEUDnetplay && (uflow || tmpcan >= (Count * 0.90)))
// {
// if(Count > tmpcan) Count=tmpcan;
// while(tmpcan > 0)
// {
// //printf("Overwrite: %d\n", (Count <= tmpcan)?Count : tmpcan);
// FCEUD_WriteSoundData(Buffer,soundScale,(Count <= tmpcan)?Count : tmpcan);
// tmpcan -= Count;
// }
// }
//#endif
// {
// /* This complex statement deserves some explanation.
// Make sure this special speed throttling hasn't been disabled by the user
// first. Second, we don't want to throttle the speed if the fast-forward
// button is pressed down(or during certain network play conditions).
// Now, if we're at this point, we'll throttle speed if sound is disabled.
// Otherwise, it gets a bit more complicated. We'll throttle speed if focus
// to FCE Ultra has been lost and we're writing to the primary sound buffer
// because our sound code won't block. Blocking does seem to work when
// writing to a secondary buffer, so we won't throttle when a secondary
// buffer is used.
// */
// //doagain: //mbg merge 6/30/06
// int skipthis = 0;
// if(!(eoptions&EO_NOTHROTTLE) || fps_scale != 256)
// if(!NoWaiting)
// if(!soundo || (soundo && nofocus && !(soundoptions&SO_SECONDARY)) || FCEUI_EmulationPaused() )
// skipthis = SpeedThrottle();
// if(XBuf)
// {
// if((!skipthis && !NoWaiting) || (BotFramesSkipped >= maxskip))
// {
// FCEUD_BlitScreen(XBuf);
// _updateMemWatch();
// BotFramesSkipped = 0;
// }
// else
// {
// BotFramesSkipped++;
// }
// }
// //mbg merge 7/19/06 - since tasbuild we have code in main that attempts to do stuff like this
// //mbg merge 6/30/06
// //if(FCEUI_EmulationPaused())
// //{
// // StopSound();
// // Sleep(50);
// // BlockingCheck();
// // goto doagain;
// //}
// }
// //mbg merge 7/19/06
// //UpdateFCEUWindow();
// //FCEUD_UpdateInput();
// _updateWindow();
//} // end of !(old sound code) block
}
/*
void FCEUD_Update(uint8 *XBuf, int32 *Buffer, int Count)
{
FCEUD_BlitScreen(XBuf);
if(Count && soundo)
FCEUD_WriteSoundData(Buffer,Count);
FCEUD_UpdateInput();
}
*/
static void FCEUD_MakePathDirs(const char *fname)
{
char path[MAX_PATH];

View File

@ -39,6 +39,8 @@
#include "..\..\palette.h" //bbit edited: this line changed to include this instead of svga.h
#include "..\..\video.h" //needed for XBuf
#include "cdlogger.h" //needed for TextHookerLoadTable
#include "fceu.h"
char *textToTrans; // buffer to hold the text that needs translating
char *transText; //holds the translated text
@ -47,8 +49,6 @@ extern void FCEUD_BlitScreen(uint8 *XBuf); //needed for pause, not sure where th
//adelikat merge 7/1/08 - had to add these extern variables
//------------------------------
extern int EmulationPaused; // may need _userpause - main.cpp 153 but I am unsure if that is used with standard pause routine
int userpause = EmulationPaused; //didn't feel like changing all instances of userpause :P
extern uint8 PALRAM[0x20];
extern uint8 PPU[4];
extern uint8 *vnapage[4];
@ -163,7 +163,7 @@ inline void DrawTextHookerChr(uint8 *pbitmap,uint8 *chr,int pal,int makeitred){
p = PALRAM[p+(pal*4)];
tmp--;
if ( userpause == 1 ) {
if ( EmulationPaused == 1 ) {
//when we're paused, makeitred determines whether to invert
//the current colors or not
if ( makeitred == 1 ) {
@ -300,7 +300,7 @@ void UpdateTextHooker() {
chr = tile*16;
//if we're paused
if ( userpause == 1 ) {
if ( EmulationPaused == 1 ) {
//if the selection has changed since we paused
if ( tileToggles[x][y] != pausedTileToggles[x][y] ) {
DrawTextHookerChr(pbitmap,&VPage[(ptable+chr)>>10][ptable+chr],tileattr,1);
@ -975,15 +975,16 @@ BOOL CALLBACK TextHookerCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
TextHookerDoBlit();
break;
case 106: //pause button (F2)
if ( userpause == 1 ) {
userpause = 0;
} else {
userpause = 1;
memcpy( pausedTileToggles, tileToggles, sizeof( tileToggles ) );
}
FCEUD_BlitScreen(XBuf+8);
break;
//mbg 8/6/08 - this looks weird
//case 106: //pause button (F2)
// if ( userpause == 1 ) {
// userpause = 0;
// } else {
// userpause = 1;
// memcpy( pausedTileToggles, tileToggles, sizeof( tileToggles ) );
// }
// FCEUD_BlitScreen(XBuf+8);
// break;
case 107: //the SNAP button (oh snap!)
if ( TableFileLoaded == 1 ) { //make sure there's a table loaded
//go through each tile

View File

@ -42,6 +42,7 @@ extern uint8 MMC5HackSPPage;
extern uint8 *RAM; //shared memory modifications
extern uint8 *GameMemBlock; //shared memory modifications
extern int EmulationPaused;
extern readfunc ARead[0x10000];
extern writefunc BWrite[0x10000];

View File

@ -29,7 +29,6 @@ using namespace std;
#define MOVIE_VERSION 3
extern char FileBase[];
extern int EmulationPaused;
using namespace std;