Correct quit when the wii is using networking, move network init to Network.cpp

This commit is contained in:
simon.kagstrom 2009-03-28 09:34:31 +00:00
parent d18dd25eb6
commit 2536022038
6 changed files with 27 additions and 13 deletions

View File

@ -759,6 +759,8 @@ void C64::VBlank(bool draw_frame)
this->network_vblank();
#if defined(GEKKO)
if (this->quit_thyself)
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
now = ticks_to_millisecs(gettime());
#else
now = SDL_GetTicks();

View File

@ -97,6 +97,7 @@ Network::~Network()
free(this->screen);
this->CloseSocket();
this->ShutdownNetwork();
}
void Network::Tick(int ms)

View File

@ -187,6 +187,8 @@ public:
protected:
void InitNetwork();
void ShutdownNetwork();
size_t DecodeSoundUpdate(struct NetworkUpdate *src, char *buf);
size_t EncodeSoundRLE(struct NetworkUpdate *dst,

View File

@ -130,3 +130,7 @@ void Network::InitNetwork()
{
/* Do nothing */
}
void Network::ShutdownNetwork()
{
}

View File

@ -124,10 +124,26 @@ bool Network::Select(int sock, struct timeval *tv)
void Network::CloseSocket()
{
#define SHUT_RDWR 2
net_shutdown(this->sock, 2);
net_close(this->sock);
}
void Network::InitNetwork()
{
fprintf(stderr, "\n\n");
char myIP[16];
/* From Snes9x-gx */
while (net_init() == -EAGAIN);
if (if_config(myIP, NULL, NULL, true) < 0)
{
fprintf(stderr, "\n\n\nError getting IP address via DHCP.\n");
sleep(2);
exit(1);
}
}
void Network::ShutdownNetwork()
{
}

View File

@ -25,22 +25,11 @@ int fixme_tmp_network_server = 0;
extern "C" int main(int argc, char **argv)
{
Frodo *the_app;
char myIP[16];
timeval tv;
gettimeofday(&tv, NULL);
srand(tv.tv_usec);
/* From Snes9x-gx */
while (net_init() == -EAGAIN);
if (if_config(myIP, NULL, NULL, true) < 0)
{
fprintf(stderr, "\n\n\nError getting IP address via DHCP.\n");
sleep(2);
exit(1);
}
printf("%s by Christian Bauer\n", VERSION_STRING);
if (!init_graphics())
{