Пример #1
0
void ExitCleanup()
{
	LWP_SuspendThread (devicethread);
	UnmountAllFAT();
	CloseShare();

#ifdef HW_RVL
	DI_Close();
#endif
}
Пример #2
0
bool
ConnectShare (bool silent)
{
	// Crashes or stalls system in GameCube mode - so disable
	#ifndef HW_RVL
	return false;
	#endif

	int chkU = (strlen(GCSettings.smbuser) > 0) ? 0:1;
	int chkP = (strlen(GCSettings.smbpwd) > 0) ? 0:1;
	int chkS = (strlen(GCSettings.smbshare) > 0) ? 0:1;
	int chkI = (strlen(GCSettings.smbip) > 0) ? 0:1;

	// check that all parameters have been set
	if(chkU + chkP + chkS + chkI > 0)
	{
		if(!silent)
		{
			char msg[50];
			char msg2[100];
			if(chkU + chkP + chkS + chkI > 1) // more than one thing is wrong
				sprintf(msg, "Check settings.xml.");
			else if(chkU)
				sprintf(msg, "Username is blank.");
			else if(chkP)
				sprintf(msg, "Password is blank.");
			else if(chkS)
				sprintf(msg, "Share name is blank.");
			else if(chkI)
				sprintf(msg, "Share IP is blank.");

			sprintf(msg2, "Invalid network settings - %s", msg);
			WaitPrompt(msg2);
		}
		return false;
	}

	if(!networkInit)
		InitializeNetwork(silent);

	if(networkInit)
	{
		if(unmountRequired[METHOD_SMB])
			CloseShare();

		if(!networkShareInit)
		{
			if(!silent)
				ShowAction ("Connecting to network share...");

			if(smbInit(GCSettings.smbuser, GCSettings.smbpwd,
					GCSettings.smbshare, GCSettings.smbip))
			{
				networkShareInit = true;
			}
		}

		if(!networkShareInit && !silent)
			WaitPrompt ("Failed to connect to network share.");
	}

	return networkShareInit;
}
Пример #3
0
	virtual void selectCallback(int which)
	{
		//printf("option entry %d selected: %s\n", which, this->pp_msgs[which]);
		switch (which)
		{
		case 0:
		case 1:
			VirtualKeyboard::kbd->activate();
			VirtualKeyboard::kbd->registerListener(this);
			break;
		case 2:
			Gui::gui->pushView(Gui::gui->nrv);
			break;
		case 4:
			if (!networkisinit) Gui::gui->pushDialogueBox(new DialogueBox(network_is_not_init_dlg));
			else if (TheC64->network)
				TheC64->network->Disconnect();
			else if ( strncmp(Gui::gui->np->NetworkName, "Unset", strlen("Unset")) == 0)
				Gui::gui->pushDialogueBox(new DialogueBox(network_unset_name_dlg));
			else
			{
				TheC64->network = new Network(Gui::gui->np->NetworkServer,
						Gui::gui->np->NetworkPort);
				TheC64->network_connection_type = CONNECT;
				Gui::gui->exitMenu();
				TheC64->network->ConnectToBroker();
			}
			break;
		case 6:
			if (TheC64->network_connection_type == NONE)
				Gui::gui->pushDialogueBox(new DialogueBox(network_need_connection));
			else
			{
				Gui::gui->exitMenu();
				TheC64->TheDisplay->TypeNetworkMessage(true);
			}
			break;
		case 7:
			if (TheC64->network_connection_type != MASTER &&
					TheC64->network_connection_type != CLIENT)
				Gui::gui->pushDialogueBox(new DialogueBox(network_need_peer));
			else
			{
				Gui::gui->exitMenu();
				TheC64->TheDisplay->TypeNetworkMessage();
			}
			break;
		case 9:
		case 10:
		case 11:
		case 12:
			VirtualKeyboard::kbd->activate();
			VirtualKeyboard::kbd->registerListener(this);
			break;
		case 13:
			if (!networkisinit) Gui::gui->pushDialogueBox(new DialogueBox(network_is_not_init_dlg));
			else {if (smbismount) CloseShare(false); else ConnectShare();this->updateMessages();}
			break;	
			
		default:
			break;
		}
	}
Пример #4
0
extern "C" int main(int argc, char **argv)
{
	timeval tv;
	gettimeofday(&tv, NULL);
	srand(tv.tv_usec);
#if defined(GEKKO)
	DIR *dir_tmp;
#endif

	// Init SDL
        if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER | SDL_INIT_JOYSTICK) < 0) {
                fprintf(stderr, "Couldn't initialize SDL (%s)\n", SDL_GetError());
                return 1;
	}
        if (TTF_Init() < 0)
        {
                fprintf(stderr, "Unable to init TTF: %s\n", TTF_GetError() );
		return 1;
        }

	fflush(stdout);

	#ifdef GEKKO
	
	printf("\x1b[2;0H");

	//initialize libfat library
	if (fatInitDefault())
		printf("FAT subsytem initialized\n\n");
	else
		{
		printf("Couldn't initialize FAT subsytem\n\n");
		sleep(3);
		exit(0);
		}
		
	DIR *dp;
    
	dp = opendir ("sd:/");
	if (dp) sdismount = 1; else sdismount = 0;
	
	if (sdismount)
		printf("SD FAT subsytem initialized\n\n");
	else
		printf("Couldn't initialize SD fat subsytem\n\n");
 	
	if (sdismount) closedir (dp);
	
	usbismount = InitUSB();
	if (usbismount) 
		printf("USB FAT subsytem initialized\n\n");
	else
		printf("Impossible to initialize USB FAT subsytem\n\n");
	
	networkisinit = InitNetwork();	
		
	sleep(2);
	
	//create tmp directory if it does not exist
	dir_tmp = opendir("/frodo/tmp");	
	if (!dir_tmp) {mkdir("/frodo/tmp",0777);printf("Making tmp directory\n");sleep(2);} else closedir(dir_tmp);
	
	//Cancel the old files
	unlink ("/frodo/tmp/a");
	unlink ("/frodo/tmp/dummy");
	
	#endif

	Frodo *the_app = new Frodo();
	the_app->ArgvReceived(argc, argv);
	the_app->ReadyToRun();
	delete the_app;
	
	if (smbismount) CloseShare (true);

	#ifdef GEKKO
	DeInitUSB();
	fatUnmount(0);
	#endif

	return 0;
}
Пример #5
0
int main (int argc, char **argv)
{
	
	#ifdef GEKKO
	
	printf("\x1b[2;0H");

	//initialize libfat library
	if (fatInitDefault())
		printf("FAT subsytem initialized\n\n");
	else
		{
		printf("Couldn't initialize FAT subsytem\n\n");
		sleep(3);
		exit(0);
		}
		
	DIR *dp;
    
	dp = opendir ("sd:/");
	if (dp) sdismount = 1; else sdismount = 0;
	
	if (sdismount)
		printf("SD FAT subsytem initialized\n\n");
	else
		printf("Couldn't initialize SD fat subsytem\n\n");
 	
	if (sdismount) closedir (dp);
	
	usbismount = InitUSB();
	

    default_prefs (&currprefs, 0);
	cfgfile_load (&currprefs, SMBFILENAME, 0);
	printf("\n");
	
	if (currprefs.smb_enable) networkisinit = InitNetwork();
	
	if (networkisinit && currprefs.smb_enable) ConnectShare(); 

	sleep(2);

	if (!(log_quiet = !currprefs.write_logfile)) set_logfile("/uae/uae.log");
	
	#endif
	
	write_log("main started\n");
    init_sdl ();
	write_log("sdl inited\n");
    gui_init (argc, argv);
	write_log("Starting real main\n");
    real_main (argc, argv);
	
	#ifdef GEKKO
	if (smbismount) CloseShare ();
	DeInitUSB();
	fatUnmount(0);
	#endif

    return 0;
}