wifi: fix bugs in winpcap init; gdb: don't emulate hardware while stalled

This commit is contained in:
zeromus 2010-01-26 09:10:21 +00:00
parent 0d47349db8
commit 823030cbaf
7 changed files with 48 additions and 11 deletions

View File

@ -1807,6 +1807,16 @@ void NDS_exec(s32 nb)
{
for(;;)
{
#ifdef GDB_STUB
//at worst, this will happen once per scanline.
//does it need to be more accurate than that? we think now
while((NDS_ARM9.stalled || NDS_ARM7.stalled) && execute)
{
driver->EMU_DebugIdleUpdate();
}
#endif
nds.cpuloopIterationCount++;
sequencer.execHardware();

View File

@ -111,14 +111,14 @@ armcpu_t NDS_ARM9;
static void
stall_cpu( void *instance) {
armcpu_t *armcpu = (armcpu_t *)instance;
printf("UNSTALL\n");
armcpu->stalled = 1;
}
static void
unstall_cpu( void *instance) {
armcpu_t *armcpu = (armcpu_t *)instance;
printf("UNSTALL\n");
armcpu->stalled = 0;
}

View File

@ -78,6 +78,7 @@ public:
virtual bool EMU_IsFastForwarding() { return false; }
virtual bool EMU_HasEmulationStarted() { return true; }
virtual bool EMU_IsAtFrameBoundary() { return true; }
virtual void EMU_DebugIdleUpdate() {}
enum eDebug_IOReg
{

View File

@ -119,6 +119,7 @@ enum {
gboolean EmuLoop(gpointer data);
static void DoQuit();
static void RecordMovieDialog();
static void PlayMovieDialog();
static void StopMovie();
@ -288,7 +289,7 @@ static const GtkActionEntry action_entries[] = {
{ "loadfirmware","gtk-open", "Load Firm_ware file", "<Ctrl>l", NULL, SelectFirmwareFile },
#endif
{ "printscreen","gtk-media-record", "Take a _screenshot", "<Ctrl>s", NULL, Printscreen },
{ "quit", "gtk-quit", "_Quit", "<Ctrl>q", NULL, gtk_main_quit },
{ "quit", "gtk-quit", "_Quit", "<Ctrl>q", NULL, DoQuit },
{ "EmulationMenu", NULL, "_Emulation" },
{ "run", "gtk-media-play", "_Run", "<Ctrl>r", NULL, Launch },
@ -397,9 +398,6 @@ public:
int disable_limiter;
int savetype;
int arm9_gdb_port;
int arm7_gdb_port;
int firmware_language;
const char *cflash_disk_image_file;
@ -411,9 +409,6 @@ public:
static void
init_configured_features( struct configured_features *config)
{
config->arm9_gdb_port = 0;
config->arm7_gdb_port = 0;
config->disable_sound = 0;
config->engine_3d = 1;
@ -1608,6 +1603,25 @@ static inline void _updateDTools()
/////////////////////////////// MAIN EMULATOR LOOP ///////////////////////////////
class GtkDriver : public BaseDriver
{
public:
virtual void EMU_DebugIdleUpdate()
{
usleep(1000);
_updateDTools();
while (gtk_events_pending())
gtk_main_iteration();
}
};
static void DoQuit()
{
emu_halt();
gtk_main_quit();
}
gboolean EmuLoop(gpointer data)
{
static Uint32 fps_SecStart, next_fps_SecStart, fps_FrameCount, skipped_frames;
@ -1811,6 +1825,8 @@ static gboolean timeout_exit_cb(gpointer data)
static int
common_gtk_main( struct configured_features *my_config)
{
driver = new GtkDriver();
SDL_TimerID limiter_timer = NULL;
GtkAccelGroup * accel_group;
@ -1865,7 +1881,7 @@ common_gtk_main( struct configured_features *my_config)
#ifdef GDB_STUB
if ( my_config->arm9_gdb_port != 0) {
arm9_gdb_stub = createStub_gdb( my_config->arm9_gdb_port,
arm9_gdb_stub = createStub_gdb( my_config->arm9_gdb_port,
&arm9_memio,
&arm9_base_memory_iface);

View File

@ -62,6 +62,11 @@ const u8 BroadcastMAC[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
pcap_t *wifi_bridge = NULL;
#endif
//sometimes this isnt defined
#ifndef PCAP_OPENFLAG_PROMISCUOUS
#define PCAP_OPENFLAG_PROMISCUOUS 1
#endif
wifimac_t wifiMac;
Adhoc_t Adhoc;
SoftAP_t SoftAP;

View File

@ -2228,6 +2228,12 @@ class WinDriver : public BaseDriver
if(anyLiveIORegViews)
RefreshAllIORegViews();
}
virtual void EMU_DebugIdleUpdate()
{
CheckMessages();
Sleep(1);
}
};
//-----------------------------------------------------------------------------

View File

@ -65,7 +65,6 @@ static void LoadWinPCap()
LOADSYMBOL(pcap_sendpacket);
LOADSYMBOL(pcap_dispatch);
CloseHandle(wpcap);
bWinPCapAvailable = true;
}