Example #1
0
void _unload(void)
{
	ioPadEnd();
	GFX->NoRSX_Exit();
	netCtlTerm();
	netDeinitialize();
}
Example #2
0
void ftp_deinit()
{
    if(!ftp_initialized) return;

    appstate = 1;

    netCtlTerm();
    netDeinitialize();

    u64 retval;
    sysThreadJoin(thread_id, &retval);

    ftp_initialized = 0;

    memset(ftp_ip_str, 0, sizeof(ftp_ip_str));
}
Example #3
0
int ftp_init()
{
    if(ftp_initialized) return 1;

    ftp_working = 0;

    if(netInitialize()<0) return -1;
    if(netCtlInit()<0) {
        netDeinitialize();
        return -2;
    }

    s32 state = 0;

    if(netCtlGetState(&state)<0 || state !=3) {
        ftp_initialized = 0;
        netCtlTerm();
        netDeinitialize();
        return -4;
    }

    union net_ctl_info info;

    if(netCtlGetInfo(NET_CTL_INFO_IP_ADDRESS, &info) == 0)
    {
        // start server thread

        appstate = 0;
        sprintf(ftp_ip_str, "FTP active (%s:%i)", info.ip_address, 21);
        sysThreadCreate(&thread_id, listener_thread, NULL, 999, 0x400, THREAD_JOINABLE, "listener");
        sysThreadCreate(&thread_id2, control_thread, NULL, 1501, 0x400, THREAD_JOINABLE, "ctrl_ftp");

        //s32 fd;
        //u64 read = 0;

        /*
        if(sysLv2FsOpen(OFTP_PASSWORD_FILE, SYS_O_RDONLY | SYS_O_CREAT, &fd, 0660, NULL, 0) == 0)
        {
        	sysLv2FsRead(fd, passwd, 63, &read);
        }

        passwd[read] = '\0';
        sysLv2FsClose(fd);


        // prevent multiline passwords
        strreplace(passwd, '\r', '\0');
        strreplace(passwd, '\n', '\0');

        */

        char dlgmsg[256];
        sprintf(dlgmsg, "OpenPS3FTP %s by jjolano (Twitter: @jjolano)\nWebsite: http://jjolano.dashhacks.com\nDonations: http://bit.ly/gB8CJo\nStatus: FTP Server Active (%s port 21)\n\nPress OK to exit this program.",
                OFTP_VERSION, info.ip_address);

        //msgDialogOpen2(mt_ok, dlgmsg, dialog_handler, NULL, NULL);
        ftp_initialized = 1;

        return 0;

    }
    else
    {
        //msgDialogOpen2(mt_ok, OFTP_ERRMSG_NETWORK, dialog_handler, NULL, NULL);

        ftp_initialized = 0;
        netCtlTerm();
        netDeinitialize();

    }

    return -3;
}