Beispiel #1
0
void LCD_Init(void)
{
    bitclr(P2OUT,RS);
    Delayx100us(250);             // Delay 100ms
    Delayx100us(250);
    Delayx100us(250);
    Delayx100us(250);
    LCD_Data |= BIT4 | BIT5;      // D7-D4 = 0011
    LCD_Data &= ~BIT6 & ~BIT7;
    _E();                         // Toggle E for LCD
    Delayx100us(100);             // 10ms
    _E();                         // Toggle E for LCD
    Delayx100us(100);             // 10ms
    _E();                         // Toggle E for LCD
    Delayx100us(100);             // 10ms
    LCD_Data &= ~BIT4;
    _E();                         // Toggle E for LCD

    Send_Cmd(DISP_ON);
    Send_Cmd(CLR_DISP);
    Delayx100us(250);
    Delayx100us(250);
    Delayx100us(250);
    Delayx100us(250);
}
Beispiel #2
0
void InitLCD(void)
{
    bitclr(P2OUT,RS);
    Delayx100us(250);                   //Delay 100ms
    Delayx100us(250);
    Delayx100us(250);
    Delayx100us(250);
    LCD_Data |= BIT4 | BIT5;            //D7-D4 = 0011
    LCD_Data &= ~BIT6 & ~BIT7;
    _E();                               //toggle E for LCD
    Delayx100us(100);                   //10ms
    _E();                               //toggle E for LCD
    Delayx100us(100);                   //10ms
    _E();                               //toggle E for LCD
    Delayx100us(100);                   //10ms
    LCD_Data &= ~BIT4;
    _E();                               //toggle E for LCD

    SEND_CMD(DISP_ON);
    SEND_CMD(CLR_DISP);
    Delayx100us(250);
    Delayx100us(250);
    Delayx100us(250);
    Delayx100us(250);
}
SLPAPI int aul_forward_app(const char* pkgname, bundle *kb)
{
	char *caller;
	int ret;
	bundle *dupb;
	bundle *outb;
	char tmp_pid[MAX_PID_STR_BUFSZ];

	if(pkgname == NULL || kb == NULL)
		return AUL_R_EINVAL;
	
	caller = (char *)bundle_get_val(kb, AUL_K_CALLER_PID);
	if(caller == NULL) {
		_E("original msg doest not have caller pid");
		return AUL_R_EINVAL;
	}
	
	bundle_del(kb, AUL_K_ORG_CALLER_PID);
	bundle_add(kb, AUL_K_ORG_CALLER_PID, caller);

	dupb = bundle_dup(kb);
	if(dupb == NULL) {
		_E("bundle duplicate fail");
		return AUL_R_EINVAL;
	}
	
	if(bundle_get_val(kb, AUL_K_WAIT_RESULT) != NULL) {
		ret = app_request_to_launchpad(APP_START_RES, pkgname, kb);
		if(ret < 0) 
			goto end;	
	} else {
		ret = app_request_to_launchpad(APP_START, pkgname, kb);
		goto end;
	}
		
//	bundle_iterate(dupb, __iterate, NULL);

	snprintf(tmp_pid, MAX_PID_STR_BUFSZ,"%d",ret);

	ret = aul_create_result_bundle(dupb, &outb);
	if(ret < 0)
		return ret;

	bundle_del(outb, AUL_K_FWD_CALLEE_PID);		
	bundle_add(outb, AUL_K_FWD_CALLEE_PID, tmp_pid);

//	bundle_iterate(outb, __iterate, NULL);

	ret = aul_send_result(outb, 1);

	bundle_free(outb);
end:
	bundle_free(dupb);

	return ret;
}
Beispiel #4
0
//--------Send command to LCD-----------------------------
void SEND_CMD (unsigned char c) {
    
	_delay_ms(LCD_CHAR_SPEED);              	//Delay for LCD char
	data_lcd = 0x0F | c;			    	//get upper nibble
	PORT_LCD = (PORT_LCD | 0xF0) & data_lcd;   	 //set D4-D7
	RS_LOW;					    			//set LCD to data mode
	_E();    
	data_lcd = c << 4;				    		//get down nibble
	PORT_LCD = (PORT_LCD & 0x0F) | data_lcd;	//set D4-D7 (only PORT_LCD-PORT_LCD)
	RS_LOW;					    			//set LCD to data mode
	_E();
}                    
Beispiel #5
0
//////////////////////////////////////////////////////////
//
// CheckLibVersions
//
// Ensure DLLs are the correct version
//
//////////////////////////////////////////////////////////
void CheckLibVersions( void )
{
#if MTASA_VERSION_TYPE == VERSION_TYPE_RELEASE

    const char* moduleList [] =     { "MTA\\loader.dll"
                                     ,"MTA\\cgui.dll"
                                     ,"MTA\\core.dll"
                                     ,"MTA\\game_sa.dll"
                                     ,"MTA\\multiplayer_sa.dll"
                                     ,"MTA\\netc.dll"
                                     ,"MTA\\xmll.dll"
                                     ,"MTA\\game_sa.dll"
                                     ,"mods\\deathmatch\\client.dll"
                                     ,"mods\\deathmatch\\pcre3.dll"
                                    };
    SString strReqFileVersion;
    for ( uint i = 0 ; i < NUMELMS( moduleList ) ; i++ )
    {
        SString strFilename = moduleList[i];
#ifdef MTA_DEBUG
        strFilename = ExtractBeforeExtension( strFilename ) + "_d." + ExtractExtension( strFilename );
#endif
        SLibVersionInfo fileInfo;
        if ( FileExists( CalcMTASAPath( strFilename ) ) )
        {
            SString strFileVersion = "0.0.0.0";
            if ( GetLibVersionInfo( CalcMTASAPath( strFilename ), &fileInfo ) )
                strFileVersion = SString( "%d.%d.%d.%d", fileInfo.dwFileVersionMS >> 16, fileInfo.dwFileVersionMS & 0xFFFF
                                                       , fileInfo.dwFileVersionLS >> 16, fileInfo.dwFileVersionLS & 0xFFFF );
            if ( strReqFileVersion.empty() )
                strReqFileVersion = strFileVersion;
            else
            if ( strReqFileVersion != strFileVersion )
            {
                DisplayErrorMessageBox ( SStringX(_( "File version mismatch error."
                                            " Reinstall MTA:SA if you experience problems.\n" )
                                            + SString( "\n[%s %s/%s]\n", *strFilename, *strFileVersion, *strReqFileVersion )
                                            ), _E("CL40"), "bad-file-version" );
                break;
            }
        }
        else
        {
            DisplayErrorMessageBox ( SStringX(_( "Some files are missing."
                                        " Reinstall MTA:SA if you experience problems.\n" )
                                        + SString( "\n[%s]\n", *strFilename )
                                        ), _E("CL41"), "missing-file" );
            break;
        }
    }
Beispiel #6
0
void SEND_CMD (unsigned char e)
{
	Delayx100us(10);                //10ms
	temp = e & 0xf0;		//get upper nibble	
	LCD_Data &= 0x0f;
	LCD_Data |= temp;               //send CMD to LCD
	bitclr(P2OUT,RS);     	        //set LCD to CMD mode
	_E();                           //toggle E for LCD
	temp = e & 0x0f;
	temp = temp << 4;               //get down nibble
	LCD_Data &= 0x0f;
	LCD_Data |= temp;
	bitclr(P2OUT,RS);   	        //set LCD to CMD mode
	_E();                           //toggle E for LCD
}
Beispiel #7
0
void SEND_CHAR (unsigned char d)
{
	Delayx100us(5);                 //.5ms	
	temp = d & 0xf0;		//get upper nibble	
	LCD_Data &= 0x0f;
	LCD_Data |= temp;               
	bitset(P2OUT,RS);     	        //set LCD to data mode
	_E();                           //toggle E for LCD
	temp = d & 0x0f;
	temp = temp << 4;               //get down nibble
	LCD_Data &= 0x0f;
	LCD_Data |= temp;
	bitset(P2OUT,RS);   	        //set LCD to data mode
	_E();                           //toggle E for LCD
}
/**
 * call result callback function
 * run in caller
 */
static int __call_app_result_callback(bundle *kb, int is_cancel,
				    int launched_pid)
{
	app_resultcb_info_t *info;
	int pgid;
	char *fwdpid_str;

	if (((info = __find_resultcb(launched_pid)) == NULL)
	    || (launched_pid < 0)) {
		_E("reject by pid - wait pid = %d, recvd pid = %d\n", getpid(),
		   launched_pid);

		/* second chance - support app launched by shell script*/
		pgid = getpgid(launched_pid);
		if (pgid <= 1)
			return -1;
		if ((info = __find_resultcb(pgid)) == NULL) {
			_E("second chance : also reject pgid - %d\n", pgid);
			return -1;
		}
	}

	if (info->cb_func == NULL || kb == NULL)
		return -1;

	/* In case of aul_forward_app, update the callback data */
	if(is_cancel == 1 &&
	(fwdpid_str = (char *)bundle_get_val(kb, AUL_K_FWD_CALLEE_PID)))
	{
		app_resultcb_info_t newinfo;
		newinfo.launched_pid = atoi(fwdpid_str);
		newinfo.cb_func = info->cb_func;
		newinfo.priv_data = info->priv_data;
		
		__remove_resultcb(info);
		__add_resultcb(newinfo.launched_pid, newinfo.cb_func, newinfo.priv_data);

		_D("change callback - %s\n",AUL_K_FWD_CALLEE_PID);
		
		goto end;
	}		

	info->cb_func(kb, is_cancel, info->priv_data);
	__remove_resultcb(info);

end:
	return 0;
}
Beispiel #9
0
void CCommunity::DoPulse ( void )
{
    if ( m_ulStartTime )
    {
        eVerificationResult Status;

        // Poll the HTTP client
        CHTTPBuffer buffer;
        if ( m_HTTP.GetData ( buffer ) ) {

            char *szBuffer = buffer.GetData ();
            
            // Get the returned status
            Status = (eVerificationResult)(szBuffer[0] - 48);
            m_bLoggedIn = Status == VERIFY_ERROR_SUCCESS;
            m_ulStartTime = 0;

            // Change GUI
            CLocalGUI::GetSingleton ().GetMainMenu()->ChangeCommunityState ( m_bLoggedIn, m_strUsername );
            CLocalGUI::GetSingleton ().GetMainMenu()->GetSettingsWindow()->OnLoginStateChange ( m_bLoggedIn );

            // Perform callback
            if ( m_pCallback ) {
                m_pCallback ( m_bLoggedIn, szVerificationMessages[Status], m_pVerificationObject );
                m_pCallback = NULL;
                m_pVerificationObject = NULL;
            }
        }
        // Check for timeout
        else if ( ( CClientTime::GetTime () - m_ulStartTime ) > VERIFICATION_DELAY ) {
            g_pCore->ShowMessageBox ( _("Error")+_E("CC01"), _("Services currently unavailable"), MB_BUTTON_OK | MB_ICON_ERROR );
            Logout ();
        }
    }
}
Beispiel #10
0
static void Send_Char (unsigned char d)
{
        int temp;
	Delayx100us(5);    //.5ms	
	temp = d & 0xf0;   // Get upper nibble	
	LCD_Data &= 0x0f;
	LCD_Data |= temp;
	bitset(P2OUT,RS);  // Set LCD to data mode
	_E();              // Toggle E for LCD
	temp = d & 0x0f;
	temp = temp << 4;  // Get down nibble
	LCD_Data &= 0x0f;
	LCD_Data |= temp;
	bitset(P2OUT,RS);  // Set LCD to data mode
	_E();              // Toggle E for LCD
}
int X_syspopup_process_keydown(int id, const char *keyname)
{
	Display *d;
	Window win;
	syspopup *sp = NULL;

	if (strcmp(keyname, KEY_END) == 0) {
		d = XOpenDisplay(NULL);
		sp = _syspopup_find_by_id(id);
		if (sp != NULL) {
			_D("find key down - %s", sp->name);
			if (sp->endkey_act == SYSPOPUP_KEYEND_TERM) {
				if (sp->def_term_fn != NULL)
					sp->def_term_fn(sp->dupped_bundle,
							sp->user_data);
				win = (Window) sp->internal_data;
				XKillClient(d, win);

			} else if (sp->endkey_act == SYSPOPUP_KEYEND_HIDE) {
				if (sp->def_term_fn != NULL)
					sp->def_term_fn(sp->dupped_bundle,
							sp->user_data);
				win = (Window) sp->internal_data;
				XUnmapWindow(d, win);
			}

		} else {
			_E("no find key down");
		}

		XCloseDisplay(d);
	}

	return 0;
}
static gboolean __X_syspopup_timeout_handler(void *user_data)
{
	syspopup *sp = NULL;
	Display *d;
	int id;
	Window win;

	id = (int)user_data;

	d = XOpenDisplay(NULL);

	sp = _syspopup_find_by_id(id);
	if (sp != NULL) {
		_D("find timeout - %s", sp->name);
		if (sp->def_timeout_fn != NULL)
			sp->def_timeout_fn(sp->dupped_bundle, sp->user_data);
		win = (Window) sp->internal_data;
		XKillClient(d, win);
	} else {
		_E("no find timeout");
	}

	XCloseDisplay(d);

	return 0;
}
Beispiel #13
0
/**
 * db initialize
 */
static int _init(void)
{
	int rc;

	if (mida_db) {
		_D("Already initialized\n");
		return 0;
	}

	rc = sqlite3_open(MIDA_DB_PATH, &mida_db);
	if (rc) {
		_E("Can't open database: %s", sqlite3_errmsg(mida_db));
		goto err;
	}
	/* Enable persist journal mode */
	rc = sqlite3_exec(mida_db, "PRAGMA journal_mode = PERSIST", NULL, NULL,
			  NULL);
	if (SQLITE_OK != rc) {
		_D("Fail to change journal mode\n");
		goto err;
	}

	return 0;
err:
	sqlite3_close(mida_db);
	return -1;
}
Beispiel #14
0
static void Send_Cmd (unsigned char e)
{
        int temp;
	Delayx100us(10);   // 10ms
	temp = e & 0xf0;   // Get upper nibble	
	LCD_Data &= 0x0f;
	LCD_Data |= temp;  // Send CMD to LCD
	bitclr(P2OUT,RS);  // Set LCD to CMD mode
	_E();              // Toggle E for LCD
	temp = e & 0x0f;
	temp = temp << 4;  // Get down nibble
	LCD_Data &= 0x0f;
	LCD_Data |= temp;
	bitclr(P2OUT,RS);  // Set LCD to CMD mode
	_E();              // Toggle E for LCD
}
Beispiel #15
0
//////////////////////////////////////////////////////////
//
// HandleNotUsedMainMenu
//
// Called when a problem occured before the main menu was used by user
// If fullscreen, then maybe change fullscreen mode
//
//////////////////////////////////////////////////////////
void HandleNotUsedMainMenu ( void )
{
    AddReportLog( 9310, "Loader - HandleNotUsedMainMenu" );
    {
        // Slighty hacky way of checking in-game settings
        SString strCoreConfigFilename = CalcMTASAPath( PathJoin( "mta", "config", "coreconfig.xml" ) );
        SString strCoreConfig;
        FileLoad( strCoreConfigFilename, strCoreConfig );
        SString strWindowed        = strCoreConfig.SplitRight( "<display_windowed>" ).Left( 1 );
        SString strFullscreenStyle = strCoreConfig.SplitRight( "<display_fullscreen_style>" ).Left( 1 );
        if ( strFullscreenStyle == "1" )
        {
            AddReportLog( 9315, "Loader - HandleNotUsedMainMenu - Already Borderless window" );
        }
        else
        if ( !strWindowed.empty() && !strFullscreenStyle.empty())
        {
            if ( strWindowed == "0" && strFullscreenStyle == "0" )   // 0=FULLSCREEN_STANDARD
            {
                // Inform user
                SString strMessage = _("Are you having problems running MTA:SA?.\n\nDo you want to change the following setting?");
                strMessage += "\n" + _("Fullscreen mode:") + " -> " + _("Borderless window");
                HideSplash();
                int iResponse = MessageBoxUTF8 ( NULL, strMessage, "MTA: San Andreas", MB_YESNO | MB_ICONQUESTION | MB_TOPMOST );
                if ( iResponse == IDYES )
                {
                    // Very hacky way of changing in-game settings
                    strCoreConfig = strCoreConfig.Replace( "<display_fullscreen_style>0", "<display_fullscreen_style>1" );
                    FileSave( strCoreConfigFilename, strCoreConfig );
                    AddReportLog( 9311, "Loader - HandleNotUsedMainMenu - User change to Borderless window" );
                }
                else
                    AddReportLog( 9313, "Loader - HandleNotUsedMainMenu - User said no" );
            }
            else
                AddReportLog( 9314, "Loader - HandleNotUsedMainMenu - Mode not fullscreen standard" );
        }
        else
        {
            // If no valid settings file yet, do the change without asking
            strCoreConfig = "<mainconfig><settings><display_fullscreen_style>1</display_fullscreen_style></settings></mainconfig>";
            FileSave( strCoreConfigFilename, strCoreConfig );
            AddReportLog( 9312, "Loader - HandleNotUsedMainMenu - Set Borderless window" );
        }
    }

    // Check if Evolve is active
    for ( auto processId : MyEnumProcesses( true ) )
    {
        SString strFilename = ExtractFilename( GetProcessPathFilename( processId ) );
        if ( strFilename.BeginsWithI( "Evolve" ) )
        {
            SString strMessage = _("Are you having problems running MTA:SA?.\n\nTry disabling the following products for GTA and MTA:");
            strMessage += "\n\nEvolve";
            DisplayErrorMessageBox ( strMessage, _E("CL43"), "not-used-menu-evolve" );
            break;
        }
    }
}
Beispiel #16
0
int main(void) {
	scanf("%d%d", &n, &p);
	for (int i = 1; i <= n; i++)
		g = (Int64) g * i % p;
	for (int i = n; i >= 1; i--) g = (Int64) g * _E(f(i)) % p;
	printf("%d\n", g);
	return 0;
}
Beispiel #17
0
//--------Initialize LCD-----------------------------
void LCD_Ini(void) {

	RS_LOW;				
	_delay_ms(110);	
	PORT_LCD=0b00110000;		
	_E();	
	_delay_ms(10);	
	PORT_LCD=0b00110000;
	_E();
	_delay_ms(10);
	PORT_LCD=0b00110000;
	_E();
	_delay_ms(10);
	PORT_LCD=0b00100000;
	_E();

}      
static int __get_defapp_from_desktop(const char *svcname, char *defapp, int len)
{
	char *pkgname = NULL;
	int ret = -1;
	ail_filter_h filter;
	ail_error_e ail_ret;
	int pkg_count = -1;

	_D("The svcname is: %s", svcname);

	ail_ret = ail_filter_new(&filter);
	if (ail_ret != AIL_ERROR_OK) 
		return ret;
	
	ail_ret = ail_filter_add_str(filter, AIL_PROP_X_SLP_SERVICE_STR, svcname);
	if (ail_ret != AIL_ERROR_OK) {
		_E("ail_filter_add_str failed");
		goto out;
	}

	ail_filter_count_appinfo(filter, &pkg_count);

	
	/* TODO: Prioritizing inhouse app depending on the UX policy */
	if (pkg_count == 1) {
		ail_filter_list_appinfo_foreach(filter, 
			__defapp_with_service_func, (void *)&pkgname);

		if(pkgname) {
			strncpy(defapp,pkgname,len);
			_D("defapp from desktop = %s", defapp);
			 aul_set_defapp_for_service(svcname, defapp);
			ret = 0;
			free(pkgname);
		}
		
	} 

 out:
	if (ail_filter_destroy(filter) != AIL_ERROR_OK)
		_E("ail_filter_destroy failed");
	return ret;
}
SLPAPI int aul_create_result_bundle(bundle *inb, bundle **outb)
{
	const char *pid_str;

	*outb = NULL;
	
	if(inb == NULL){
		_E("return msg create fail");
		return AUL_R_EINVAL;
	}

	*outb = bundle_create();
	if (*outb == NULL) {
		_E("return msg create fail");
		return AUL_R_ERROR;
	}

	if(bundle_get_val(inb, AUL_K_WAIT_RESULT) != NULL) {
		bundle_add(*outb, AUL_K_SEND_RESULT, "1");
		_D("original msg is msg with result");
	} else {
		_D("original msg is not msg with result");
	}
	

	pid_str = bundle_get_val(inb, AUL_K_ORG_CALLER_PID);
	if(pid_str) {
		bundle_add(*outb, AUL_K_ORG_CALLER_PID, pid_str);
		goto end;
	}
	
	pid_str = bundle_get_val(inb, AUL_K_CALLER_PID);
	if (pid_str == NULL) {
		_E("original msg doest not have caller pid");
		bundle_free(*outb);
		*outb = NULL;
		return AUL_R_EINVAL;
	}
	bundle_add(*outb, AUL_K_CALLER_PID, pid_str);

end:
	return AUL_R_OK;
}
Beispiel #20
0
/*
 * call-seq:
 *   nwfilter.uuid -> string
 *
 * Call +virNWFilterGetUUIDString+[http://www.libvirt.org/html/libvirt-libvirt.html#virNWFilterGetUUIDString]
 * to retrieve the network filter UUID.
 */
static VALUE libvirt_nwfilter_uuid(VALUE s) {
    virNWFilterPtr nwfilter = nwfilter_get(s);
    int r;
    char uuid[VIR_UUID_STRING_BUFLEN];

    r = virNWFilterGetUUIDString(nwfilter, uuid);
    _E(r < 0, create_error(e_RetrieveError, "virNWFilterGetUUIDString",
                           conn(s)));

    return rb_str_new2((char *)uuid);
}
Beispiel #21
0
// Update
void NmMainDlgRefresh(HWND hWnd, RPC *r)
{
#if	0
	RPC_NAT_STATUS t;
	wchar_t tmp[MAX_SIZE];
	wchar_t tmp2[MAX_SIZE];
	// Validate arguments
	if (r == NULL || hWnd == NULL)
	{
		return;
	}

	Zero(&t, sizeof(RPC_NAT_STATUS));

	CALL(hWnd, NcGetStatus(r, &t));

	if (t.Online == false)
	{
		UniStrCpy(tmp, sizeof(tmp), _UU("NM_OFFLINE"));

		Enable(hWnd, B_CONNECT);
		Disable(hWnd, B_DISCONNECT);
	}
	else
	{
		if (t.Connected)
		{
			UniFormat(tmp, sizeof(tmp), _UU("NM_CONNECTED"), t.Status.ServerName);
		}
		else
		{
			if (t.LastError == ERR_NO_ERROR)
			{
				UniStrCpy(tmp, sizeof(tmp), _UU("NM_CONNECTING"));
			}
			else
			{
				UniFormat(tmp, sizeof(tmp), _UU("NM_CONNECT_ERROR"), t.LastError, _E(t.LastError));
			}
		}
		Disable(hWnd, B_CONNECT);
		Enable(hWnd, B_DISCONNECT);
	}

	UniFormat(tmp2, sizeof(tmp2), _UU("NM_STATUS_TAG"), tmp);

	SetText(hWnd, S_STATUS, tmp2);

	FreeRpcNatStatus(&t);
#endif
}
Beispiel #22
0
int o_add(struct options *o, u8 type, u8 len, void *value) {
	
	u16 real_len = len + 2; /* data len + 1 byte type and 1 byte len */
	if (o->pos + real_len > MAX_OPTIONS_LEN) {
		_E(V_CRY,"ran out of option space: %d + %u > %u",
			o->pos,real_len, MAX_OPTIONS_LEN);
		return FAIL;
	}
	o->data[o->pos++] = type;
	o->data[o->pos++] = len;
	COPY((u8 *) value,&o->data[o->pos],len);
	o->pos += real_len;
	return SUCCESS;
}
Beispiel #23
0
Expression* Syntactic::E() {
	Expression* ope = nullptr;
    Expression* oper = nullptr;

	ope = T();
	oper = _E();

	if(oper != nullptr)
		oper->l = ope;
	else
		oper = ope;

	return oper;
}
///////////////////////////////////////////////////////////////
//
// CResourceFileDownloadManager::DoPulse
//
// Downloading initial resource files
//
///////////////////////////////////////////////////////////////
void CResourceFileDownloadManager::DoPulse()
{
    if (!g_pNet->IsConnected())
        return;

    if (!IsTransferringInitialFiles())
        return;

    // Pulse the http downloads
    uint uiDownloadSizeTotal = 0;
    for (auto serverInfo : m_HttpServerList)
    {
        CNetHTTPDownloadManagerInterface* pHTTP = g_pNet->GetHTTPDownloadManager(serverInfo.downloadChannel);
        pHTTP->ProcessQueuedFiles();
        uiDownloadSizeTotal += pHTTP->GetDownloadSizeNow();
    }

    // Handle fatal error
    if (!m_strLastHTTPError.empty())
    {
        // Throw the error and disconnect
        g_pCore->GetConsole()->Printf(_("Download error: %s"), *m_strLastHTTPError);
        AddReportLog(7106, SString("Game - HTTPError (%s)", *m_strLastHTTPError));

        g_pCore->GetModManager()->RequestUnload();
        g_pCore->ShowMessageBox(_("Error") + _E("CD20"), *m_strLastHTTPError, MB_BUTTON_OK | MB_ICON_ERROR);            // HTTP Error
        m_bIsTransferingFiles = false;
        return;
    }

    // Update progress box
    GetTransferBox()->SetInfo(uiDownloadSizeTotal);
    GetTransferBox()->DoPulse();

    // Check if completed downloading current group
    if (m_ActiveFileDownloadList.empty())
    {
        // Hide progress box if all groups done
        if (m_PendingFileDownloadList.empty())
        {
            m_bIsTransferingFiles = false;
            GetTransferBox()->Hide();
        }

        // Load our newly ready resources
        g_pClientGame->GetResourceManager()->OnDownloadGroupFinished();
        UpdatePendingDownloads();
    }
}
Beispiel #25
0
HAPI void page_scroller_show_region(Evas_Object *scroller, int idx)
{
	Evas_Object *index;
	int w, h;

	evas_object_geometry_get(scroller, NULL, NULL, &w, &h);
	elm_scroller_region_show(scroller, idx * w, 0, w, h);

	index = evas_object_data_get(scroller, "index");
	if (!index) {
		_E("cannot find index.");
	}
	_D("page index bring in to %d", idx);
	index_bring_in(index, idx);
}
SLPAPI int aul_set_defapp_for_service(const char *svcname, const char *defapp)
{
	if ((svcname == NULL) || (defapp == NULL))
		return AUL_R_EINVAL;

	if (!is_supported_svc(svcname))
		return AUL_R_EINVAL;

	if (svc_add_app(svcname, defapp) < 0) {
		_E("fail to add");
		return AUL_R_ERROR;
	}

	return AUL_R_OK;
}
Beispiel #27
0
int svc_add_app(const char *svc_name, const char *pkg_name)
{
	int rc = -1;
	int cnt = 0;
	char *_sqlbuf;

	retvm_if(svc_name == NULL, -1, "Service name is null\n");
	retvm_if(pkg_name == NULL, -1, "Package name is null\n");

	if (__doubt_sql_injection(svc_name))
		return -1;

	if (_init() < 0)
		return -1;

	cnt = __count_with_field(SVC_TBL_NAME, SVC_F_SVCNAME, svc_name, 0);

	if (cnt == 0) {
		/* insert */
		_D("Inserting (%s, %s)", pkg_name, svc_name);
		_sqlbuf = sqlite3_mprintf(
		     "INSERT INTO %s (%s,%s) values (\"%s\", \"%s\");",
		     SVC_TBL_NAME, SVC_F_PKGNAME, SVC_F_SVCNAME, pkg_name,
		     svc_name);

		rc = _exec(mida_db, _sqlbuf);
		sqlite3_free(_sqlbuf);
	} else {
		/* update */
		_D("Setting %s for %s", pkg_name, svc_name);
		_sqlbuf = sqlite3_mprintf(
				    "UPDATE %s SET %s = '%s' where %s = '%s';",
				    SVC_TBL_NAME, SVC_F_PKGNAME, pkg_name,
				    SVC_F_SVCNAME, svc_name);

		rc = _exec(mida_db, _sqlbuf);
		sqlite3_free(_sqlbuf);
	}

	if (rc < 0)
		_E("fail to insert or update\n");

	__fini();
	return rc;
}
Beispiel #28
0
/**
 * exec  
 * param[in] db handler
 * param[in] query query
 * return This method returns 0 (SUCCESS) or -1 (FAIL)
 */
static int _exec(sqlite3 *db, char *query)
{
	int rc = 0;
	char *errmsg = NULL;

	retvm_if(db == NULL, -1, "DB handler is null");

	rc = sqlite3_exec(db, query, NULL, 0, &errmsg);

	if (rc != SQLITE_OK) {
		_D("Query: [%s]", query);
		_E("SQL error: %s\n", errmsg);
		sqlite3_free(errmsg);
		return (-1);
	}

	return 0;
}
Beispiel #29
0
HAPI void page_scroller_bring_in(Evas_Object *scroller, int idx)
{
	Evas_Object *index;
	int w, h;

	_D("BRING IN TO %d", idx);

	evas_object_data_set(scroller, "current_idx", (void *) idx);

	evas_object_geometry_get(scroller, NULL, NULL, &w, &h);
	elm_scroller_region_bring_in(scroller, idx * w, 0, w, h);

	index = evas_object_data_get(scroller, "index");
	if (!index) {
		_E("cannot find index.");
	}
	_D("page index bring in to %d", idx);
	index_bring_in(index, idx);
}
Beispiel #30
0
HAPI Evas_Object *layout_create(Evas_Object *conformant, const char *file, const char *group, int rotate)
{
	Evas_Object *layout;

	do {
		int width;
		int height;

		layout = layout_load_edj(conformant, file, group);
		retv_if(NULL == layout, NULL);

		width = menu_screen_get_root_width();
		height = menu_screen_get_root_height() - INDEX_HEIGHT;

		evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
		evas_object_size_hint_min_set(layout, width, height);
		evas_object_size_hint_max_set(layout, width, height);
		evas_object_resize(layout, width, height);
		evas_object_show(layout);

		evas_object_data_set(layout, "win", menu_screen_get_win());
		evas_object_data_set(layout, "rotate", (void *) rotate);
		evas_object_data_set(layout, "width", (void *) width);
		evas_object_data_set(layout, "height", (void *) height);
	} while (0);

	do {
		Evas_Object *all_apps;

		all_apps = all_apps_layout_create(layout, rotate);
		if (NULL == all_apps) {
			_E("Failed to create scroller");
			layout_destroy(layout);
			return NULL;
		}
		evas_object_data_set(layout, "all_apps", all_apps);
		elm_object_part_content_set(layout, "content", all_apps);
	} while (0);

	return layout;
}