void CRTTransferSession::OnTypeTLogout(TRANSFERMODULE fmodule, const std::string& str)
{
    LI("%s was called\n", __FUNCTION__);
}
예제 #2
0
파일: psp.c 프로젝트: Joonie86/REBUG-4.21
	"sceATRAC3plus_Library",
};

static char *umd_file;
static mutex_t mutex;
static int user_mutex;
static int umd_fd=-1;
static char psp_id[11];
static uint64_t pemucorelib_base;
static uint64_t emulator_api_base;
static uint32_t *savedata_param;

/* vsh.self */
SprxPatch psp_drm_patches[] =
{
	{ psp_drm_patch1, LI(R3, 0) 	},
	{ psp_drm_patch2, LI(R3, 0) 	},
	{ psp_drm_patch3, LI(R3, 0) 	},
	{ psp_drm_patch4, LI(R0, 0) 	},
	{ psp_drm_patchA, LI(R0, 0) 	},
	{ psp_drm_patchB, LI(R31, 0) 	},
	{ psp_drm_patchC, LI(R3, 0) 	},	
	{ psp_drm_patchD, NOP 		},
	{ psp_drm_patchE, LI(R3, 0) 	},
	{ psp_drm_patchF, LI(R3, 0) 	},
	{ 0 }
};

SprxPatch cex_psp_drm_patches[] =
{
	{ cex_psp_drm_patch1, LI(R3, 0) 	},
예제 #3
0
int main(int argc, const char * argv[]) {
    LI("Hello, RTLive!!!\n");
    LRTRTLive::PrintVersion();

    if (argc <= 1) {
        std::cout << "Error: Please usage:$0 {conf_path} " << std::endl;
        std::cout << "Please enter any key to exit ..." << std::endl;
        getchar();
        exit(0);
    }
#if 0
#if _TEST_
    if (RTZKClient::Instance().InitOnly(argv[1])!=0) {
#else
    if (RTZKClient::Instance().InitZKClient(argv[1])!=0) {
#endif
        std::cout << "Please check the config file ..." << std::endl;
        std::cout << "Please enter any key to exit ..." << std::endl;
        getchar();
        exit(0);
    }

    int level = RTZKClient::Instance().GetServerConfig().Level;
    std::string logpath = RTZKClient::Instance().GetServerConfig().LogPath;
    if (logpath.empty())
        L_Init(level, NULL);
    else
        L_Init(level, logpath.c_str());
#endif

#if 0
    L_Init(0, NULL);
#else
    L_Init(0, "./ms_rtlive.log");
#endif
    LRTRTLive::Initialize(1024);
    LRTRTLive* pRTLive = LRTRTLive::Inst();
    //////LI("server listen port:%u\n", RTZKClient::Instance().GetServerConfig().portConfig.storage.ListenClicon);
    //int res = pRTLive->Start(RTZKClient::Instance().GetServerConfig().IP.c_str(),
    //                  RTZKClient::Instance().GetServerConfig().portConfig.storage.ListenClicon
    //                  );
    //signal(SIGUSR1, sighandler);
    //signal(SIGUSR2, sighandler);
    //6690 for group client module
    int res = pRTLive->Start("192.168.7.207", 6690, "192.168.7.207", 6680, "192.168.7.207", 6620, "192.168.7.207", 6670, "192.168.7.207", 6640);
    int test = 0;
    if (res != 0) {
        LI("LRTRTLive start failed and goto exit, res:%d\n", res);
        goto EXIT;
    }
#if 0
    while (test++ < 60) {
#else
    while (1) {
#endif
        pRTLive->DoTick();
        sleep(1);
        //break;
    }
        sleep(1);
EXIT:
    pRTLive->Stop();
    LRTRTLive::DeInitialize();
    L_Deinit();
    //RTZKClient::Instance().Unin();
    google::protobuf::ShutdownProtobufLibrary();
    return 0;
}
void CRTTransferSession::OnTypeConn(TRANSFERMODULE fmodule, const std::string& str)
{
    CONNMSG c_msg;
    std::string err;
    c_msg.GetMsg(str, err);
    if (err.length()>0) {
        LE("CRTTransferSession::OnTypeConn GetMsg err:%s\n", err.c_str());
        return;
    }
    if ((c_msg._tag == CONNTAG::co_msg) && c_msg._msg.compare("hello") == 0) {
        // when other connect to ME:
        // generate TransferSessionId
        // send self ModuleId and TransferSessionId to other
        TRANSFERMSG t_msg;
        std::string trid;
        GenericSessionId(trid);
        m_transferSessId = trid;

        t_msg._action = TRANSFERACTION::req;
        //this is for transfer
        t_msg._fmodule = TRANSFERMODULE::mconnector;
        t_msg._type = TRANSFERTYPE::conn;
        t_msg._trans_seq = GenericTransSeq();
        t_msg._trans_seq_ack = 0;
        t_msg._valid = 1;

        c_msg._tag = CONNTAG::co_id;
        c_msg._id = trid;
        //send self connector to other
        c_msg._moduleid = CRTConnManager::Instance().ConnectorId();

        t_msg._content = c_msg.ToJson();
        std::string s = t_msg.ToJson();
        SendTransferData(s.c_str(), (int)s.length());
    } else if ((c_msg._tag == CONNTAG::co_msgid) && c_msg._msgid.compare("ok") == 0) {
        // when other connect to ME:
        //get other's TransferSessionId and ModuleId
        if (m_transferSessId.compare(c_msg._id)==0) {
            CRTConnManager::ModuleInfo* pmi = new CRTConnManager::ModuleInfo();
            if (pmi) {
                pmi->flag = 1;
                //store other's module type
                pmi->othModuleType = fmodule;
                pmi->othModuleId = m_transferSessId;
                pmi->pModule = this;
                //bind session and transfer id
                CRTConnManager::Instance().AddModuleInfo(pmi, m_transferSessId);
                //store which moudle connect to this connector
                //c_msg._moduleid: store other's module id
                CRTConnManager::Instance().AddTypeModuleSession(fmodule, c_msg._moduleid, m_transferSessId);
                LI("store the other's module fmodule:%d, id:%s, transfersessid:%s\n", (int)fmodule,  c_msg._moduleid.c_str(), c_msg._id.c_str());
            } else {
                LE("new ModuleInfo error!!!\n");
            }
        }

    } else if (c_msg._tag == CONNTAG::co_keepalive) {
        this->RTTcp::UpdateTimer();
    } else {
        LE("%s invalid msg tag\n", __FUNCTION__);
    }
}
예제 #5
0
uint8_t condition_pemucorelib = 1;
uint64_t vsh_check;
//uint8_t condition_game_ext_psx=0;
int bc_to_net_status=0;

//uint8_t block_peek = 0;

// Plugins
sys_prx_id_t vsh_plugins[MAX_VSH_PLUGINS];
static int loading_vsh_plugin;

SprxPatch cex_vsh_patches[] =
{
	// { cex_game_update_offset, LI(R3, -1), &condition_disable_gameupdate }, [DISABLED by DEFAULT since 4.46]
	{ cex_ps2tonet_patch, ORI(R3, R3, 0x8204), &condition_ps2softemu },
	{ cex_ps2tonet_size_patch, LI(R5, 0x40), &condition_ps2softemu },
	{ cex_ps2tonet_patch, ORI(R3, R3, 0x8202), &condition_false },
	{ cex_ps2tonet_size_patch, LI(R5, 0x4f0), &condition_false },
	{ 0 }
};

SprxPatch dex_vsh_patches[] =
{
	//{ dex_game_update_offset, LI(R3, -1), &condition_disable_gameupdate },
	{ dex_ps2tonet_patch, ORI(R3, R3, 0x8204), &condition_ps2softemu },
	{ dex_ps2tonet_size_patch, LI(R5, 0x40), &condition_ps2softemu },
	{ dex_ps2tonet_patch, ORI(R3, R3, 0x8202), &condition_false },
	{ dex_ps2tonet_size_patch, LI(R5, 0x4f0), &condition_false },
	//{ dex_enable_dlna_patch, LI(R4, 1), &condition_true },		
	//{ dex_fake_owner_popup_patch, NOP, &condition_true }, // Hard-coded in REX 4.81.2	
	{ 0 }
예제 #6
0
파일: k.c 프로젝트: geocar/qlua
static int enc(K*k,lua_State *L)
{
	switch (lua_type(L, -1)) {
	case LUA_TSTRING: 	{ size_t len;const char *str = lua_tolstring(L,-1,&len);(*k)=kpn(str,len);R 1;}	break;
	case LUA_TNUMBER:	{ F num = lua_tonumber(L,-1);(*k) = (num==floor(num))?kj((J)num):kf(num);R 1;} break;
	case LUA_TBOOLEAN:	{ (*k)=kb( lua_toboolean(L,-1) );R 1;}	break;
	case LUA_TNIL:		{ (*k)=ktn(0,0);R 1;}	break;
	case LUA_TTABLE:	{
		double p;
		int max = 0;
		int items = 0;
		int t_integer = 0, t_number = 0, t_boolean = 0, t_other= 0;

		lua_pushnil(L);
		/* table, startkey */
		while (lua_next(L, -2) != 0) {
			items++;

			/* table, key, value */
			switch (lua_type(L, -1)) {
			case LUA_TNUMBER:  t_number++; p = lua_tonumber(L,-1);  t_integer += (floor(p) == p); break;
			case LUA_TBOOLEAN: t_boolean++; break;
			default:   t_other++; break;	/* or anything else */
			};

			if (lua_type(L, -2) == LUA_TNUMBER &&
					(p = lua_tonumber(L, -2))) {
				/* Integer >= 1 ? */
				if (floor(p) == p && p >= 1) {
					if (p > max)
						max = p;
					lua_pop(L, 1);
					continue;
				}
			}

			/* Must not be an array (non integer key) */
			for (lua_pop(L,1); lua_next(L, -2) != 0; lua_pop(L,1)) ++items;
			max = 0;
			break;
		}
		lua_pushnil(L);
		if (max != items) {
			/* build K dictionary */
			K keys = ktn(KS,items);
			K values = ktn(0,items);
			int n = 0;
			/* table, startkey */
			while (lua_next(L, -2) != 0) {
				kS(keys)[n] = ss(lua_tostring(L, -2));
				if(!enc(kK(values)+n,L))R 0;
				lua_pop(L,1);
				++n;
			}
			*k = xD(keys,values);
			R 1;
		}
		/* build K list */
		if(t_other || ((!!t_boolean)+(!!t_number)) > 1) {
			K a = ktn(0,items);
			while (lua_next(L, -2) != 0) {
				p = lua_tonumber(L, -2);
				if(!enc(kK(a)+LI(p),L))R 0;
				lua_pop(L, 1);
			}
			*k = a;
			R 1;
		}
		if(t_boolean) {
			K a = ktn(KB,items);
			while (lua_next(L, -2) != 0) {
				p = lua_tonumber(L, -2);
				kG(a)[LI(p)] = lua_toboolean(L,-1);
				lua_pop(L, 1);
			}
			*k = a;
			R 1;
		}
		if(t_number == t_integer) {
			K a = ktn(KJ,items);
			while (lua_next(L, -2) != 0) {
				p = lua_tonumber(L, -2);
				kJ(a)[LI(p)] = (int)floor(lua_tonumber(L,-1));
				lua_pop(L, 1);
			}
			*k = a;
			R 1;
		}
		if(t_number) {
			K a = ktn(KF,items);
			while (lua_next(L, -2) != 0) {
				p = lua_tonumber(L, -2);
				kF(a)[LI(p)] = lua_tonumber(L,-1);
				lua_pop(L, 1);
			}
			*k = a;
			R 1;
		}
		*k = ktn(0,0);
		R 1;
	}; break;
	default:
		luaL_error(L, "Cannot serialise %s: %s", lua_typename(L, lua_type(L, -1)), "can't serialize type");
		R 0;
	};
}
예제 #7
0
uint8_t condition_psp_dec = 0;
uint8_t condition_psp_keys = 0;
uint8_t condition_psp_change_emu = 0;
uint8_t condition_psp_prometheus = 0;

uint8_t block_peek = 0;

// Plugins
sys_prx_id_t vsh_plugins[MAX_VSH_PLUGINS];
static int loading_vsh_plugin;

#if defined(SPRX)
#if defined(CEX_KERNEL)
SprxPatch vsh_patches[] =
{
	{ elf1_func1 + elf1_func1_offset, LI(R3, 1), &condition_true },
	{ elf1_func1 + elf1_func1_offset + 4, BLR, &condition_true },
	{ elf1_func2 + elf1_func2_offset, NOP, &condition_true },
	// { game_update_offset, LI(R3, -1), &condition_disable_gameupdate }, 
	// { ps2tonet_patch, ORI(R3, R3, 0x8204), &condition_ps2softemu },
	// { ps2tonet_size_patch, LI(R5, 0x40), &condition_ps2softemu },
	{ 0 }
};

SprxPatch cex_vsh_patches[] =
{
	{ cex_elf1_func1 + cex_elf1_func1_offset, LI(R3, 1), &condition_true },
	{ cex_elf1_func1 + cex_elf1_func1_offset + 4, BLR, &condition_true },
	{ cex_elf1_func2 + cex_elf1_func2_offset, NOP, &condition_true },
	// { game_update_offset, LI(R3, -1), &condition_disable_gameupdate }, 
	// { ps2tonet_patch, ORI(R3, R3, 0x8204), &condition_ps2softemu },
예제 #8
0
파일: main.c 프로젝트: Joonie86/CobraUSB
typedef struct
{
	uint32_t address;
	uint32_t data;
	uint8_t *condition;
} Patch;

static uint8_t condition_true = 1;
static uint8_t condition_iso = 0;
static uint8_t condition_optical = 0;
static uint8_t condition_ps2_cdda = 0;

static Patch patches[] =
{
	{ ps2_disc_auth_caller_symbol,   LI(3, 0), &condition_true },
	{ ps2_disc_auth_caller_symbol+4, BLR, &condition_true },
	{ COMPAT_OFFSET, MR(0, 8), &condition_true },
	{ DISC_TYPE_OFFSET, LI(3, 0x13), &condition_ps2_cdda }, /* hack for ps2 cdda, SCECdPS2CD -> SCECdPS2CDDA */
};

#define N_PATCHES	(sizeof(patches) / sizeof(Patch))

static INLINE void *get_data_buffer(void)
{
	return (void *) *(uint64_t *)(*(uint64_t *)((TOC+DATA_TOC_OFFSET)));
}

static INLINE uint8_t *get_buffer_from_lpar(uint64_t lpar)
{
	uint64_t lpar1 = *(uint64_t *)(*(uint64_t *)((TOC+LPAR_TOC_OFFSET)));
예제 #9
0
파일: main.c 프로젝트: Joonie86/COBRA-7.3
#else
	#define IS_CFW			0
#endif

#define MAKE_VERSION(cobra, fw, type) ((cobra&0xFF) | ((fw&0xffff)<<8) | ((type&0x1)<<24))

typedef struct
{
	uint32_t address;
	uint32_t data;
} Patch;

static Patch kernel_patches[] =
{
	{ patch_data1_offset, 0x01000000 },
	{ patch_func8_offset1, LI(R3, 0) }, // force lv2open return 0

	// disable calls in lv2open to lv1_send_event_locally which makes the system crash
	{ patch_func8_offset2, NOP },
	{ patch_func9_offset, NOP }, // 4.30 - watch: additional call after

	// psjailbreak, PL3, etc destroy this function to copy their code there.
	// We don't need that, but let's dummy the function just in case that patch is really necessary
	{ mem_base2, LI(R3, 1) },
	{ mem_base2 + 4, BLR },

	// sys_sm_shutdown, for ps2 let's pass to copy_from_user a fourth parameter
	{ shutdown_patch_offset, MR(R6, R31) },
	{ module_sdk_version_patch_offset, NOP },

	// User thread prio hack (needed for netiso)
예제 #10
0
void igl::crouzeix_raviart_cotmatrix(
  const Eigen::MatrixBase<DerivedV> & V, 
  const Eigen::MatrixBase<DerivedF> & F, 
  const Eigen::MatrixBase<DerivedE> & E,
  const Eigen::MatrixBase<DerivedEMAP> & EMAP,
  Eigen::SparseMatrix<LT> & L)
{
  // number of rows
  const int m = F.rows();
  // Element simplex size
  const int ss = F.cols();
  // Mesh should be edge-manifold
  assert(F.cols() != 3 || is_edge_manifold(F));
  typedef Eigen::Matrix<LT,Eigen::Dynamic,Eigen::Dynamic> MatrixXS;
  MatrixXS C;
  cotmatrix_entries(V,F,C);
  Eigen::MatrixXi F2E(m,ss);
  {
    int k =0;
    for(int c = 0;c<ss;c++)
    {
      for(int f = 0;f<m;f++)
      {
        F2E(f,c) = k++;
      }
    }
  }
  // number of entries inserted per facet
  const int k = ss*(ss-1)*2;
  std::vector<Eigen::Triplet<LT> > LIJV;LIJV.reserve(k*m);
  Eigen::VectorXi LI(k),LJ(k),LV(k);
  // Compensation factor to match scales in matlab version
  double factor = 2.0;

  switch(ss)
  {
    default: assert(false && "unsupported simplex size");
    case 3:
      factor = 4.0;
      LI<<0,1,2,1,2,0,0,1,2,1,2,0;
      LJ<<1,2,0,0,1,2,0,1,2,1,2,0;
      LV<<2,0,1,2,0,1,2,0,1,2,0,1;
      break;
    case 4:
      factor *= -1.0;
      LI<<0,3,3,3,1,2,1,0,1,2,2,0,0,3,3,3,1,2,1,0,1,2,2,0;
      LJ<<1,0,1,2,2,0,0,3,3,3,1,2,0,3,3,3,1,2,1,0,1,2,2,0;
      LV<<2,3,4,5,0,1,2,3,4,5,0,1,2,3,4,5,0,1,2,3,4,5,0,1;
      break;
  }

  for(int f=0;f<m;f++)
  {
    for(int c = 0;c<k;c++)
    {
      LIJV.emplace_back(
        EMAP(F2E(f,LI(c))),
        EMAP(F2E(f,LJ(c))),
        (c<(k/2)?-1.:1.) * factor *C(f,LV(c)));
    }
  }
  L.resize(E.rows(),E.rows());
  L.setFromTriplets(LIJV.begin(),LIJV.end());
}
예제 #11
0
void PDRkEpsilon::correct()
{
    if (!turbulence_)
    {
        // Re-calculate viscosity
        nut_ = Cmu_*sqr(k_)/epsilon_;
        nut_.correctBoundaryConditions();

        // Re-calculate thermal diffusivity
        //***HGWalphat_ = mut_/Prt_;
        //alphat_.correctBoundaryConditions();

        return;
    }

    RASModel::correct();

    volScalarField divU(fvc::div(phi_/fvc::interpolate(rho_)));

    if (mesh_.moving())
    {
        divU += fvc::div(mesh_.phi());
    }

    tmp<volTensorField> tgradU = fvc::grad(U_);
    volScalarField G(GName(), rho_*nut_*(tgradU() && dev(twoSymm(tgradU()))));
    tgradU.clear();

    // Update espsilon and G at the wall
    epsilon_.boundaryField().updateCoeffs();

    // Add the blockage generation term so that it is included consistently
    // in both the k and epsilon equations
    const volScalarField& betav =
        U_.db().lookupObject<volScalarField>("betav");

    const volScalarField& Lobs =
        U_.db().lookupObject<volScalarField>("Lobs");

    const PDRDragModel& drag =
        U_.db().lookupObject<PDRDragModel>("PDRDragModel");

    volScalarField GR(drag.Gk());

    volScalarField LI
        (C4_*(Lobs + dimensionedScalar("minLength", dimLength, VSMALL)));

    // Dissipation equation
    tmp<fvScalarMatrix> epsEqn
    (
        betav*fvm::ddt(rho_, epsilon_)
      + fvm::div(phi_, epsilon_)
      - fvm::laplacian(rho_*DepsilonEff(), epsilon_)
     ==
        C1_*betav*G*epsilon_/k_
      + 1.5*pow(Cmu_, 3.0/4.0)*GR*sqrt(k_)/LI
      - fvm::SuSp(((2.0/3.0)*C1_)*betav*rho_*divU, epsilon_)
      - fvm::Sp(C2_*betav*rho_*epsilon_/k_, epsilon_)
    );

    epsEqn().relax();

    epsEqn().boundaryManipulate(epsilon_.boundaryField());

    solve(epsEqn);
    bound(epsilon_, epsilonMin_);


    // Turbulent kinetic energy equation

    tmp<fvScalarMatrix> kEqn
    (
        betav*fvm::ddt(rho_, k_)
      + fvm::div(phi_, k_)
      - fvm::laplacian(rho_*DkEff(), k_)
     ==
        betav*G + GR
      - fvm::SuSp((2.0/3.0)*betav*rho_*divU, k_)
      - fvm::Sp(betav*rho_*epsilon_/k_, k_)
    );

    kEqn().relax();
    solve(kEqn);
    bound(k_, kMin_);

    // Re-calculate viscosity
    nut_ = Cmu_*sqr(k_)/epsilon_;
    nut_.correctBoundaryConditions();

    // Re-calculate thermal diffusivity
    //***HGWalphat_ = mut_/Prt_;
    //alphat_.correctBoundaryConditions();
}
void DRTTransferSession::OnTypeQueue(TRANSFERMODULE fmodule, const std::string& str)
{
    TOJSONUSER auser;//all user
    QUEUEMSG qmsg;
    {
        //get auser
        std::string err;
        qmsg.GetMsg(str, err);
        if (err.length()>0) {
            LE("%s QUEUEMSG err:%s\n", __FUNCTION__, err.c_str());
            return;
        }
        auser.GetMsg(qmsg._touser, err);
        if (err.length()>0) {
            LE("%s TOJSONUSER err:%s\n", __FUNCTION__, err.c_str());
            return;
        }
    }
    LI("Queue msg:%s\n", str.c_str());
    bool needDispatch = false;
    bool needPush = false;
    TOJSONUSER duser;//dispatcher
    TOJSONUSER allduser;
    ////TOJSONUSER puser;//pusher
    DRTConnManager::UserConnectorMaps connUserId;
    {
        //check user online or offline
        std::list<std::string>::iterator it = auser._us.begin();
        for (; it!=auser._us.end(); it++) {
            if (DRTConnManager::Instance().IsMemberInOnline((*it))) {
                std::string cid("");
                DRTConnManager::Instance().GetUserConnectorId((*it), cid);
                //printf("dispatch userid:%s, connectorid:%s\n", (*it).c_str(), cid.c_str());
                connUserId.insert(make_pair(cid, (*it)));
                allduser._us.push_back(*it);
                needDispatch = true;
            } else {
                ////puser._us.push_back((*it));
                needPush = true;
            }
        }
    }
    {
        //if online, push to online msgqueue
        if (needDispatch) {
            unsigned i=0, j=(unsigned)connUserId.bucket_count();
            for (; i<j; ++i) {
                if (connUserId.begin(i)==connUserId.end(i)) {
                    continue;
                }
                std::string sess = connUserId.begin(i)->first;
                for (auto& x:connUserId) {
                    duser._us.push_back(x.second);
                }
                DISPATCHMSG dmsg;
                dmsg._flag = 0;
                dmsg._touser = duser.ToJson();
                dmsg._connector = connUserId.begin(i)->first;//which connector comes from
                dmsg._content = qmsg._content;
                std::string sd = dmsg.ToJson();
                LI("OnTypeQueue dmsg._touser:%s, dmsg._connector.c_str():%s\n", dmsg._touser.c_str(), dmsg._connector.c_str());
                m_msgDispatch.SendData(sd.c_str(), (int)sd.length());
            }
        }
    }
    {
        //if offline, push to offline msgqueue
        if (needPush) {
            PUSHMSG pmsg;
            pmsg._flag = 0;
            ////pmsg._touser = puser.ToJson();
            pmsg._touser = allduser.ToJson();
            pmsg._connector = qmsg._connector;//which connector comes from
            pmsg._content = qmsg._content;

            std::string sp = pmsg.ToJson();
            LI("OnTypeQueue pmsg._touser:%s, pmsg._connector.c_str():%s\n", pmsg._touser.c_str(), pmsg._connector.c_str());
            m_msgDispatch.PushData(sp.c_str(), (int)sp.length());
        }
    }
}
void DRTTransferSession::OnTypeTrans(TRANSFERMODULE fmodule, const std::string& str)
{
    LI("%s was called, str:%s\n", __FUNCTION__, str.c_str());
}
예제 #14
0
bool RTHiredis::HandleHReply(redisReply* reply, std::list<const std::string>* ress)
{
    switch (reply->type) {
        case REDIS_REPLY_STRING:
        {
            if (ress) {
                ress->push_front(reply->str);
            } else {
                LI("hreply str:%s\n", reply->str);
            }
        }
            break;
        case REDIS_REPLY_ARRAY:
        {
            int n = (int)reply->elements;
            int i=0;
            for (;i<n;i++) {
                redisReply* rp = (redisReply*)*(reply->element);
                if (rp) {
                    //LI("RTHiredis::HandleReply ARRAY was called\n");
                    HandleHReply(rp, ress);
                }
            }
        }
            break;
        case REDIS_REPLY_INTEGER:
        {
            if (ress) {
                char c[12] = {0};
                sprintf(c, "%lld", reply->integer);
                ress->push_front(c);
            } else {
                LI("hreply int:%lld\n", reply->integer);
            }
        }
            break;
        case REDIS_REPLY_NIL:
        {
            LI("hreply nil\n");
        }
            break;
        case REDIS_REPLY_STATUS:
        {
            LI("hreply status\n");
        }
            break;
        case REDIS_REPLY_ERROR:
        {
            if (ress) {
                ress->push_front(reply->str);
            } else {
                LI("hreply err:%s\n", reply->str);
            }
        }
            break;
        default:
        {
            LE("hreply default handle\n");
        }
            break;
    }
    return true;
}
void RTConnectionManager::TransferSessionLostNotify(const std::string& sid)
{
    DelModuleInfo(sid);
    DelTypeModuleSession(sid);
    LI("RTConnectionManager::TransferSessionLostNotify sessionid:%s\n", sid.c_str());
}
예제 #16
0
int	RTConnector::Start(const char*pLanIP, unsigned short usConnPort, const char*pModuleAddr, unsigned short usModulePort, const char*pConnTcpAddr, unsigned short usConnTcpPort, const char* pHttpAddr, unsigned short usHttpPort)
{
	Assert(g_inited);
	Assert(pLanIP != NULL && strlen(pLanIP)>0);
	Assert(pModuleAddr != NULL && strlen(pModuleAddr)>0);
    Assert(pConnTcpAddr != NULL && strlen(pConnTcpAddr));
    Assert(pHttpAddr != NULL && strlen(pHttpAddr));
	//1, Check lan addr.
    RTHiredisLocal::Instance()->Connect();
    
    LI("Start set HttpAddr:%s, port:%u\n", pHttpAddr, usHttpPort);
    RTHiredisRemote::Instance()->SetHostAddr(pHttpAddr, usHttpPort);
    RTHiredisRemote::Instance()->Connect();

    std::string ssid;
	RTConnection::gStrAddr = pLanIP;
    RTConnection::gUsPort = usConnPort;
    RTDispatchConnection::m_connIp = pLanIP;
    RTDispatchConnection::m_connPort = usConnPort;
    RTConnectionManager::Instance()->GenericSessionId(ssid);
    RTConnectionManager::Instance()->SetConnectorInfo(pLanIP, usConnPort, ssid.c_str());
    LI("[][]ConnectorId:%s\n", ssid.c_str());


	if(usConnPort == 0)
	{
		LE("Connector server conn need ...!");
		Assert(false);
	}

	if(usConnPort > 0)
	{
		m_pConnListener = new RTConnListener();
		OS_Error err = m_pConnListener->Initialize(INADDR_ANY, usConnPort);
		if (err!=OS_NoErr)
		{
			LE("CreateConnListener error port=%d \n", usConnPort);
			delete m_pConnListener;
			m_pConnListener=NULL;

			return -1;
		}
		LI("Start Connector Conn service:(%d) ok...,socketFD:%d\n", usConnPort, m_pConnListener->GetSocketFD());
		m_pConnListener->RequestEvent(EV_RE);
	}
    
    if (usModulePort == 0) {
        LE("Connector server meet need ...!!");
        Assert(false);
    }
    
    if (usModulePort > 0) {
        m_pModuleListener = new RTModuleListener();
        OS_Error err = m_pModuleListener->Initialize(INADDR_ANY, usModulePort);
        if (err!=OS_NoErr) {
            LE("CreateModuleListener error port:%d\n", usModulePort);
            delete m_pModuleListener;
            m_pModuleListener = NULL;
            return -1;
        }
        LI("Start Connector Module service:(%d) ok...,socketFD:%d\n", usModulePort, m_pModuleListener->GetSocketFD());
        m_pModuleListener->RequestEvent(EV_RE);
    }
    
    if (usConnTcpPort == 0) {
        LE("Connector server meet need ...!!!!");
        Assert(false);
    }
    if (usConnTcpPort > 0) {
        m_pConnTcpListener = new RTConnTcpListener();
        OS_Error err = m_pConnTcpListener->Initialize(INADDR_ANY, usConnTcpPort);
        if (err!=OS_NoErr) {
            LE("CreateConnTcpListener error port:%d\n", usConnTcpPort);
            delete m_pConnTcpListener;
            m_pConnTcpListener = NULL;
            return -1;
        }
        LI("Start Connector ConnTcp service:(%d) ok...,socketFD:%d\n", usConnTcpPort, m_pConnTcpListener->GetSocketFD());
        m_pConnTcpListener->RequestEvent(EV_RE);
    }
    if (usHttpPort == 0) {
        LE("Connector server meet need ...!!!!");
        Assert(false);
    }
    if (usHttpPort > 0) {
        LI("Start Connector Http service:(%d) ok...\n", usHttpPort);
    }

	return 0;
}
예제 #17
0
SInt64 RTTcp::Run()
{
	EventFlags events = this->GetEvents();
	this->ForceSameThread();
	// Http session is short connection, need to kill session when occur TimeoutEvent.
	// So return -1.
	if(events&Task::kTimeoutEvent || events&Task::kKillEvent)
	{
        if (events&Task::kTimeoutEvent) {
            LI("%s timeout \n", __FUNCTION__);
        } else {
            LI("%s kill \n", __FUNCTION__);
        }
        std::map<RTTcp*, RTObserverConnection*>::iterator it = m_mapConnectObserver.find(this);
        if (it != m_mapConnectObserver.end()) {
            LI("Tcp::Run find Disconnection\n");
            RTObserverConnection *conn = it->second;
            if (conn) {
                LI("Tcp::Run notify Disconnection\n");
                conn->ConnectionDisconnected();
            }
        }
		return -1;
	}


	while(this->IsLiveSession())
	{
		if(events&Task::kReadEvent)
		{
			UInt32	readed = 0;
			char	fRequestBuffer[kRequestBufferSizeInBytes];
			while(1)
			{
				readed = 0;
				// We don't have any new data, get some from the socket...
				OS_Error sockErr = fSocket.Read(fRequestBuffer, kRequestBufferSizeInBytes - 1, &readed);
				if (sockErr == EAGAIN)
					break;

				if (sockErr != OS_NoErr)
				{
					Assert(!fSocket.IsConnected());
					break;
				}

				if(readed > 0)
				{
					OnRecvData(fRequestBuffer, readed);
				}
			}

			fSocket.RequestEvent(EV_RE);
			events -= Task::kReadEvent; 
		}
		else if(events&Task::kWriteEvent)
		{
			ListElement *elem = NULL; 
			if((elem = m_listSend.first) != NULL) 
			{ 
				UInt32 theLengthSent = 0;
				OS_Error err = fSocket.Send((char*)elem->content, elem->size, &theLengthSent);
				if (err == EAGAIN)
				{
					fSocket.RequestEvent(EV_RE | EV_WR);
				}
				else
				{
					ListRemoveHead(&m_listSend); 
					if(NULL != m_listSend.first)
						this->Signal(kWriteEvent);
				}
				
			}
			events -= Task::kWriteEvent; 
		}
		else if(events&Task::kLcsEvent)
		{
			OnLcsEvent();
			events -= Task::kLcsEvent;
		}
		else if(events&Task::kPeerEvent)
		{
			OnPeerEvent();
			events -= Task::kPeerEvent; 
		}
		else if(events&Task::kIdleEvent)
		{
			OnTickEvent();
			events -= Task::kIdleEvent; 
		}
		else
		{
			return fTickTime;
		}
	}

	// If we are here because of a timeout, but we can't delete because someone
    // is holding onto a reference to this session, just reschedule the timeout.
    //
    // At this point, however, the session is DEAD.
    std::map<RTTcp*, RTObserverConnection*>::iterator it = m_mapConnectObserver.find(this);
    if (it != m_mapConnectObserver.end()) {
        LI("Tcp::Run SessionOffline  find Disconnection\n");
        RTObserverConnection *conn = it->second;
        if (conn) {
            LI("Tcp::Run SessionOffline notify Disconnection\n");
            conn->ConnectionDisconnected();
        }
    }
    return -1;
}
예제 #18
0
wxString GenerateHTMLString() {
  gCurrentString = _T("");

  AddStringLn(_T("<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN'>"));
  AddStringLn(_T("<html>"));
  AddStringLn(_T("<head>"));
  AddStringLn(_T("<meta http-equiv='content-type' content='text/html; charset=Western-1252'>"));
  AddStringLn(_T("<title>Appetizer</title>"));

  AddStringLn(_T("<style TYPE='text/css'>"));
	AddStringLn(_T("<!--"));
  AddStringLn(_T("h2 { color:#ff4f02; }"));
  AddStringLn(_T("h3 {  }"));
	AddStringLn(_T("-->"));
	AddStringLn(_T("</style>"));

  AddStringLn(_T("</head>"));
  AddStringLn(_T("<body>"));

  IMG(_T("images/Logo.jpg"));  

  // *******************************************************************************
  // INTRODUCTION
  // *******************************************************************************

  H2(_("Introduction"));
  H3(_("About Appetizer"));
  P(_("Appetizer is a dock bar that allows you to organize, display and launch your applications and other shortcuts. Currently it is possible to add executables, documents and folders to the dock. Additionally, if you use Appetizer on a USB key in the [http://portableapps.com PortableApps] format, the application will detect it and automatically import all your applications along with the 'Documents', 'Videos', 'Music' and 'Pictures' folders."));
  
  // -------------------------------------------------
  // Features
  // -------------------------------------------------
  H3(_("Features"));

  StartList();
  LI(_("Resizable dock, which allows displaying the icons both horizontally or vertically."));
  LI(_("Support for multiple skins"));
  LI(_("Two size of icons: Small and large"));
  LI(_("Organize the icons by drag & dropping them"));
  LI(_("'Multi-launch' functionality"));
  LI(_("Regroup multiple shortcuts within one menu"));
  LI(_("Support for multiple languages"));
  LI(_("Minimize to tray icon functionality"));
  EndList();

  IMG(_T("images/Screenshot.jpg"));


  // *******************************************************************************
  // USING APPETIZER
  // *******************************************************************************

  H2(_("Using Appetizer"));
  P(_("Appetizer is made to be simple and intuitive. To get more information about an icon or a button, simply move the mouse over it. Additionally, try right-clicking the dock in different places - certain parts of the application such as the icons or the icon panel provide various contextual actions."));
  
  // -------------------------------------------------
  // Adding a shortcut
  // -------------------------------------------------
  H3(_("Adding a shortcut"));
  P(_("To add a shortcut, right-click anywhere on the icon panel and select 'New shortcut', then click on [images/SelectFile.jpg] to select a file or [images/SelectFolder.jpg] to select a folder. Once this is done, the 'Name' field should be automatically populated based on the file or folder you've chosen. Finally, you may also specify some additional parameters in the 'Parameters' field. This could be a path to a file or some switches specific to the application. This field is only relevant for executables and is optional."));  

  // -------------------------------------------------
  // Adding a group
  // -------------------------------------------------  
  H3(_("Adding a group of shortcuts"));
  P(_("To create a group of shortcuts, right-click anywhere on the icon panel, select 'New group', give a name to the group, and click 'Save'. To add shortcuts to this group, click or right-click on it and select 'Organize group shortcuts'. The newly opened window display all your shortcuts in a tree-like control. You can drag & drop these icons to add them to the group. You can also reorder them in a different, still by drag & dropping them. Once this is done, click the 'Close' button."));  

  // -------------------------------------------------
  // Changing the icon of a group
  // -------------------------------------------------  
  H3(_("Changing the icon of a group"));
  P(_("A group can take the icon of any of the shortcuts it contains. To do so, right-click on a group and select 'Properties'. Then click on 'Select a different icon'. If the group doesn't contain any shortcut, only the default icon can be selected."));  

  // -------------------------------------------------
  // Modifying or deleting a group or shortcut
  // -------------------------------------------------  
  H3(_("Modifying, moving or deleting a group or shortcut"));
  P(_("To change the properties of an icon, such as its name or location, right-click on it and select 'Properties'. To move an icon to a different location, click and drag it. To remove a shortcut, right-click on it and select 'Remove'.")); 

  // -------------------------------------------------
  // Minimizing / Maximizing the dock
  // -------------------------------------------------
  H3(_("Minimizing / Maximizing the dock"));
  P(_("The dock can be minimized to the tray icon by clicking on the 'x' button. To bring it back to front, simply click on the tray icon."));
  P(_("Right-click on the tray icon for additional options."));

  // -------------------------------------------------
  // The option panel
  // -------------------------------------------------
  A(_T(""), _T(""), _T("OptionPanel"));
  H3(_("The option panel"));
  IMG(_T("images/OptionPanel.jpg"));
  P(_("The option panel pops up when you click on the big arrow button. If you move the mouse over any of its buttons, a tooltip will show up giving you more information."));

  // -------------------------------------------------
  // Launching several application simultaneously
  // -------------------------------------------------
  H3(_("Launching several application simultaneously"));
  P(_("Appetizer provides a functionality to launch several applications at the click of a button. This is equivalent to the Startup menu on Windows, except that it launches the app on your portable drive. To use this 'Multi-launch' group, follow these steps:"));
  StartList();
  LI(_("Right-click on any icon and select 'Multi-launch group' from the context menu"));
  LI(_("You can add as many shortcuts as you wish"));
  LI(_("To trigger the 'Multi-launch' group, open the [#OptionPanel option panel] and click on the 'Multi-launch' button: [images/Multilaunch.jpg]"));
  EndList();

  // *******************************************************************************
  // CONFIGURING APPETIZER
  // *******************************************************************************
  H2(_("Configuring Appetizer"));
  P(_("The configuration dialogue is accessible by clicking on the 'Configuration' button in the [#OptionPanel option panel]. The description of each setting is given below:"));

  H3(_("General"));
  StartList();
  LI(_("[b]Language:[/b] Select your language here. If you wish to contribute and translate Appetizer in your own language, please [#Translating follow this link]."));
  LI(_("[b]Auto-hide after launching an application:[/b] Select this option to have Appetizer hides itself each time you launch an application."));
  LI(_("[b]Always on top:[/b] If this is selected the bar will always remain on top of the other windows."));
  LI(_("[b]Allow only one instance of Appetizer at a time:[/b] If this is selected, only one instance of Appetizer can run at a time."));
  LI(_("[b]Check for update:[/b] Click this button to check if a new update is available."));
  EndList();

  H3(_("Appearance"));
  StartList();
  LI(_("[b]Icon size:[/b] Choose the size of the icons, as displayed on the bar."));
  LI(_("[b]Orientation:[/b] The bar can be vertically or horizontally orientated."));
  LI(_("[b]Skin:[/b] Choose one of the available skins."));
  EndList();

  // *******************************************************************************
  // OTHER TIPS
  // *******************************************************************************
  H2(_("Other tips"));
  StartList();
  LI(_("You can resize the dock by clicking and dragging its bottom right corner."));
  LI(_("You can move it by clicking anywhere on the icon panel and dragging."));
  LI(_("The bar will snap to the borders of the screens as you move it."));
  EndList();

  // *******************************************************************************
  // TRANSLATING APPETIZER
  // *******************************************************************************
  A(_T(""), _T(""), _T("Translating"));
  H2(_("Translating Appetizer"));
  P(_("If Appetizer is not available in your own language, you can easily create your own translation. To do so, please follow these steps:"));
  StartList();
  LI(_("[http://www.poedit.net/ Download Poedit] and install it. This is a utility that makes it easier to create and maintain translation files."));
  LI(_("Open the folder where you've installed Appetizer and open the Data\\Locale folder"));
  LI(_("Copy and paste the 'en' folder."));
  LI(_("Within that folder, open 'appetizer.po' with Poedit."));
  LI(_("In Poedit, go into the Catalog menu and click Configuration. Change 'Country' and 'Language' to your own country and language."));
  LI(_("Now, to translate a line of text, click on it and add your translated text in the bottom text field."));
  LI(_("Once all the text is translated, please email 'appetizer.po' and 'appetizer.mo' to [email protected]"));
  EndList();
  P(_("Your translation will be added in the next release."));

  H3(_("Translating the help file"));
  P(_("If you wish to translate the help file, follow the same steps as above and edit the file in Data\\Help\\en\\appetizer.po."));

  AddStringLn(_T("</body>"));
  AddStringLn(_T("</html>"));

  return gCurrentString;
}
예제 #19
0
IGL_INLINE bool igl::lu_lagrange(
  const Eigen::SparseMatrix<T> & ATA,
  const Eigen::SparseMatrix<T> & C,
  Eigen::SparseMatrix<T> & L,
  Eigen::SparseMatrix<T> & U)
{
#if EIGEN_VERSION_AT_LEAST(3,0,92)
#if defined(_WIN32)
  #pragma message("lu_lagrange has not yet been implemented for your Eigen Version")
#else
  #warning lu_lagrange has not yet been implemented for your Eigen Version
#endif

  return false;
#else
  // number of unknowns
  int n = ATA.rows();
  // number of lagrange multipliers
  int m = C.cols();

  assert(ATA.cols() == n);
  if(m != 0)
  {
    assert(C.rows() == n);
    if(C.nonZeros() == 0)
    {
      // See note above about empty columns in C
      fprintf(stderr,"Error: lu_lagrange() C has columns but no entries\n");
      return false;
    }
  }

  // Check that each column of C has at least one entry
  std::vector<bool> has_entry; has_entry.resize(C.cols(),false);
  // Iterate over outside
  for(int k=0; k<C.outerSize(); ++k)
  {
    // Iterate over inside
    for(typename Eigen::SparseMatrix<T>::InnerIterator it (C,k); it; ++it)
    {
      has_entry[it.col()] = true;
    }
  }
  for(int i=0;i<(int)has_entry.size();i++)
  {
    if(!has_entry[i])
    {
      // See note above about empty columns in C
      fprintf(stderr,"Error: lu_lagrange() C(:,%d) has no entries\n",i);
      return false;
    }
  }



  // Cholesky factorization of ATA
  //// Eigen fails if you give a full view of the matrix like this:
  //Eigen::SparseLLT<SparseMatrix<T> > ATA_LLT(ATA);
  Eigen::SparseMatrix<T> ATA_LT = ATA.template triangularView<Eigen::Lower>();
  Eigen::SparseLLT<Eigen::SparseMatrix<T> > ATA_LLT(ATA_LT);

  Eigen::SparseMatrix<T> J = ATA_LLT.matrixL();

  //if(!ATA_LLT.succeeded())
  if(!((J*0).eval().nonZeros() == 0))
  {
    fprintf(stderr,"Error: lu_lagrange() failed to factor ATA\n");
    return false;
  }

  if(m == 0)
  {
    // If there are no constraints (C is empty) then LU decomposition is just L
    // and L' from cholesky decomposition
    L = J;
    U = J.transpose();
  }else
  {
    // Construct helper matrix M
    Eigen::SparseMatrix<T> M = C;
    J.template triangularView<Eigen::Lower>().solveInPlace(M);

    // Compute cholesky factorizaiton of M'*M
    Eigen::SparseMatrix<T> MTM = M.transpose() * M;

    Eigen::SparseLLT<Eigen::SparseMatrix<T> > MTM_LLT(MTM.template triangularView<Eigen::Lower>());

    Eigen::SparseMatrix<T> K = MTM_LLT.matrixL();

    //if(!MTM_LLT.succeeded())
    if(!((K*0).eval().nonZeros() == 0))
    {
      fprintf(stderr,"Error: lu_lagrange() failed to factor MTM\n");
      return false;
    }

    // assemble LU decomposition of Q
    Eigen::Matrix<int,Eigen::Dynamic,1> MI;
    Eigen::Matrix<int,Eigen::Dynamic,1> MJ;
    Eigen::Matrix<T,Eigen::Dynamic,1> MV;
    igl::find(M,MI,MJ,MV);

    Eigen::Matrix<int,Eigen::Dynamic,1> KI;
    Eigen::Matrix<int,Eigen::Dynamic,1> KJ;
    Eigen::Matrix<T,Eigen::Dynamic,1> KV;
    igl::find(K,KI,KJ,KV);

    Eigen::Matrix<int,Eigen::Dynamic,1> JI;
    Eigen::Matrix<int,Eigen::Dynamic,1> JJ;
    Eigen::Matrix<T,Eigen::Dynamic,1> JV;
    igl::find(J,JI,JJ,JV);

    int nnz = JV.size()  + MV.size() + KV.size();

    Eigen::Matrix<int,Eigen::Dynamic,1> UI(nnz);
    Eigen::Matrix<int,Eigen::Dynamic,1> UJ(nnz);
    Eigen::Matrix<T,Eigen::Dynamic,1> UV(nnz);
    UI << JJ,                        MI, (KJ.array() + n).matrix();
    UJ << JI, (MJ.array() + n).matrix(), (KI.array() + n).matrix(); 
    UV << JV,                        MV,                     KV*-1;
    igl::sparse(UI,UJ,UV,U);

    Eigen::Matrix<int,Eigen::Dynamic,1> LI(nnz);
    Eigen::Matrix<int,Eigen::Dynamic,1> LJ(nnz);
    Eigen::Matrix<T,Eigen::Dynamic,1> LV(nnz);
    LI << JI, (MJ.array() + n).matrix(), (KI.array() + n).matrix();
    LJ << JJ,                        MI, (KJ.array() + n).matrix(); 
    LV << JV,                        MV,                        KV;
    igl::sparse(LI,LJ,LV,L);
  }

  return true;
  #endif
}
예제 #20
0
파일: mswin.c 프로젝트: icostin/acx1
/* acx1_read_event **********************************************************/
ACX1_API unsigned int ACX1_CALL acx1_read_event (acx1_event_t * event_p)
{
    INPUT_RECORD ir;
    DWORD n;
    uint16_t ch;
    uint32_t m;

    for (;;)
    {
        if (!ReadConsoleInputW(hin, &ir, 1, &n))
        {
            LE("read console input failed!\n");
            return ACX1_TERM_IO_FAILED;
        }
        if (ir.EventType == WINDOW_BUFFER_SIZE_EVENT)
        {
            event_p->type = ACX1_RESIZE;
            event_p->size.w = ir.Event.WindowBufferSizeEvent.dwSize.X;
            event_p->size.h = ir.Event.WindowBufferSizeEvent.dwSize.Y;
            LI("screen resized to %ux%u\n", event_p->size.w, event_p->size.h);
            return 0;
        }
        if (ir.EventType == KEY_EVENT)
        {
            if (!ir.Event.KeyEvent.bKeyDown) continue;
            m = 0;
            if (ir.Event.KeyEvent.dwControlKeyState &
                    (LEFT_ALT_PRESSED | RIGHT_ALT_PRESSED))
                m |= ACX1_ALT;
            if (ir.Event.KeyEvent.dwControlKeyState &
                    (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED))
                m |= ACX1_CTRL;
            if (ir.Event.KeyEvent.dwControlKeyState & SHIFT_PRESSED)
                m |= ACX1_SHIFT;
            event_p->type = ACX1_KEY;
            ch = ir.Event.KeyEvent.uChar.UnicodeChar;
            if (ch >= 0x20)
                event_p->km = (m & ~ACX1_SHIFT) | ir.Event.KeyEvent.uChar.UnicodeChar;
            else //if (ch > 0)
            {

                if (ch == 0x08 || ch == 0x09 || ch == 0x0D) m = ch;
                else
                {
                    // event_p->km = ACX1_CTRL | 0x40 | ch;
                    switch (ch = ir.Event.KeyEvent.wVirtualKeyCode)
                    {
                    case VK_BACK:
                        m |= ACX1_BACKSPACE;
                        break;
                    case VK_TAB:
                        m |= ACX1_TAB;
                        break;
                    case VK_RETURN:
                        m |= ACX1_ENTER;
                        break;
                    case VK_ESCAPE:
                        m |= ACX1_ESC;
                        break;
                    case VK_SPACE:
                        m |= ACX1_SPACE;
                        break;
                    case VK_PRIOR:
                        m |= ACX1_PAGE_UP;
                        break;
                    case VK_NEXT:
                        m |= ACX1_PAGE_DOWN;
                        break;
                    case VK_END:
                        m |= ACX1_END;
                        break;
                    case VK_HOME:
                        m |= ACX1_HOME;
                        break;
                    case VK_LEFT:
                        m |= ACX1_LEFT;
                        break;
                    case VK_UP:
                        m |= ACX1_UP;
                        break;
                    case VK_RIGHT:
                        m |= ACX1_RIGHT;
                        break;
                    case VK_DOWN:
                        m |= ACX1_DOWN;
                        break;
                    case VK_INSERT:
                        m |= ACX1_INS;
                        break;
                    case VK_DELETE:
                        m |= ACX1_DEL;
                        break;
                    case VK_F1:
                        m |= ACX1_F1;
                        break;
                    case VK_F2:
                        m |= ACX1_F2;
                        break;
                    case VK_F3:
                        m |= ACX1_F3;
                        break;
                    case VK_F4:
                        m |= ACX1_F4;
                        break;
                    case VK_F5:
                        m |= ACX1_F5;
                        break;
                    case VK_F6:
                        m |= ACX1_F6;
                        break;
                    case VK_F7:
                        m |= ACX1_F7;
                        break;
                    case VK_F8:
                        m |= ACX1_F8;
                        break;
                    case VK_F9:
                        m |= ACX1_F9;
                        break;
                    case VK_F10:
                        m |= ACX1_F10;
                        break;
                    case VK_F11:
                        m |= ACX1_F11;
                        break;
                    case VK_F12:
                        m |= ACX1_F12;
                        break;
                    default:
                        if ((ch >= '0' && ch <= '9') ||
                                (ch >= 'A' && ch <= 'Z')) m |= ch;
                        else continue;
                    }
                }

                event_p->km = m;
            }
            // else { event_p->km = '?'; }
            LI("got key: 0x%X\n", event_p->km);
            return 0;
        }
    }
}
예제 #21
0
파일: main.c 프로젝트: Ps3itaTeam/PS2_EMU
#endif

typedef struct
{
    uint32_t address;
    uint32_t data;
    uint8_t *condition;
} Patch;

static uint8_t condition_true = 1;
static uint8_t condition_iso = 0;
static uint8_t condition_optical = 0;

static Patch patches[] =
{
    { ps2_disc_auth_caller_symbol,   LI(3, 0), &condition_true },
    { ps2_disc_auth_caller_symbol+4, BLR, &condition_true },
};

#define N_PATCHES	(sizeof(patches) / sizeof(Patch))

static INLINE void *get_data_buffer(void)
{
    return (void *) *(uint64_t *)(*(uint64_t *)((TOC+DATA_TOC_OFFSET)));
}

static INLINE uint8_t *get_buffer_from_lpar(uint64_t lpar)
{
    uint64_t lpar1 = *(uint64_t *)(*(uint64_t *)((TOC+LPAR_TOC_OFFSET)));
    uint64_t lpar2 = lpar1+0x1000;
    uint64_t lpar3 = lpar1+0x400;
예제 #22
0
파일: main.cpp 프로젝트: tanaga9/appetizer
wxString GenerateHTMLString() {
  gCurrentString = _T("");

  AddStringLn(_T("<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN'>"));
  AddStringLn(_T("<html>"));
  AddStringLn(_T("<head>"));
  // Although the file is going to be written as UTF-8, we set the charset here to
  // Western-1252, which is the only format supported by CHM files. The generated HTML files
  // then need to be converted to ANSI using a text editor.
  AddStringLn(_T("<meta http-equiv='content-type' content='text/html; charset=Western-1252'>"));
  AddStringLn(_T("<title>Appetizer</title>"));
  AddStringLn(_T("<style TYPE='text/css'>"));
	AddStringLn(_T("<!--"));
  AddStringLn(_T("h2 { color:#ff4f02; }"));
  AddStringLn(_T("h3 {  }"));
	AddStringLn(_T("-->"));
	AddStringLn(_T("</style>"));

  AddStringLn(_T("</head>"));
  AddStringLn(_T("<body>"));

  IMG(_T("images/Logo.jpg"));  

  // *******************************************************************************
  // INTRODUCTION
  // *******************************************************************************

  H2(_("Introduction"));
  H3(_("About Appetizer"));
  P(_("Appetizer is a free application launcher, or dock, for Windows. It allows organizing and launching your applications and other shortcuts into a convenient dock. The app is skinable and entirely customizable."));
  P(_("Additionally, the application supports the [http://portableapps.com PortableApps] format. So if you use Appetizer on a removable drive in the PortableApps format, the application will detect it and automatically import all your applications along with the 'Documents', 'Videos', 'Music' and 'Pictures' folders."));
  
  // -------------------------------------------------
  // Features
  // -------------------------------------------------
  H3(_("Features"));

  StartList();
  LI(_("Support for multiple skins"));
  LI(_("Support for plugins"));
  LI(_("Resizable dock, which allows displaying the icons both horizontally or vertically."));
  LI(_("Three sizes of icons: Small, large and extra-large"));
  LI(_("Support for custom icons"));
  LI(_("'Wizard' to automatically imports shortcuts from various locations"));
  LI(_("Organize the icons by drag & dropping them"));
  LI(_("'Multi-launch' functionality"));
  LI(_("Regroup multiple shortcuts within one menu"));
  LI(_("Hot key to hide / show the dock"));
  LI(_("Special items to provide extra functionalities: hide / show the desktop, Recycle Bin, Control Panel, etc."));
  LI(_("Support for multiple languages"));
  LI(_("Minimize to tray icon functionality"));
  EndList();

  IMG(_T("images/Screenshot.jpg"));


  // *******************************************************************************
  // USING APPETIZER
  // *******************************************************************************

  AddAnchor(_T("Usage"));
  H2(_("Using Appetizer"));
  P(_("Appetizer is made to be simple and intuitive. To get more information about an icon or a button, simply move the mouse over it. Additionally, try right-clicking the dock in different places - certain parts of the application such as the icons or the icon panel provide various contextual actions."));
  
  // -------------------------------------------------
  // Adding a shortcut
  // -------------------------------------------------
  H3(_("Adding a shortcut"));
  P(_("To add a shortcut, right-click anywhere on the icon panel and select 'New shortcut', then select a file or folder. Alternatively, you may also directly drag and drop a file onto the dock."));

  // -------------------------------------------------
  // Adding a group
  // -------------------------------------------------  
  H3(_("Adding a group of shortcuts"));
  P(_("To create a group of shortcuts, right-click anywhere on the icon panel, select 'New group', give a name to the group, and click 'Save'. To add shortcuts to this group, click or right-click on it and select 'Organize group shortcuts'. The newly opened window display all your shortcuts in a tree-like control. You can drag & drop these icons to add them to the group. You can also reorder them, still by drag & dropping them. Once this is done, click the 'Close' button."));  

  // -------------------------------------------------
  // Adding a special item
  // -------------------------------------------------
  H3(_("Adding a special items"));
  P(_("Special items provide additional functionalities that would not be possible using a normal shortcut. The special items include a 'Show desktop' button, the Recycle Bin, a link to the Control Panel, etc.")); 
  P(_("To add a special item, right-click on the dock and select 'Add special item'.")); 

  // -------------------------------------------------
  // Modifying or deleting a group or shortcut
  // -------------------------------------------------  
  H3(_("Modifying, moving or deleting a group or shortcut"));
  P(_("To change the properties of an icon, such as its name or location, right-click on it and select 'Properties'. To move an icon to a different location, click and drag it. To remove a shortcut, right-click on it and select 'Remove'.")); 

  // -------------------------------------------------
  // Changing the properties of a shortcut or group
  // -------------------------------------------------  
  AddAnchor(_T("FolderItemProperties"));
  H3(_("Changing the properties of a shortcut or group"));
  P(_("To change the properties of a shortcut or group, right-click on an icon and select 'Properties'. The following options are available:"));  
  StartList();
  LI(_("Name: The name displayed in the tooltip"));
  LI(_("Location: The target of the shortcut. Click on the '...' button to change it."));
  LI(_("Parameters: You may also specify some additional command line arguments in this field. This could be a path to a file or some switches specific to the application. This field is only relevant for executables and is optional."));
  LI(_("Icon: Click on 'Change icon' to select a custom icon. Click on 'Use default' to revert the icon to the default."));
  EndList();

  // -------------------------------------------------
  // Minimizing / Maximizing the dock
  // -------------------------------------------------
  H3(_("Minimizing / Maximizing the dock"));
  P(_("The dock can be minimized to the tray icon by clicking on the 'x' button. To bring it back to front, simply click on the tray icon. Note that this behavior can be changed in the 'Configuration' dialog"));
  P(_("Right-click on the tray icon for additional options."));

  // -------------------------------------------------
  // The option panel
  // -------------------------------------------------
  AddAnchor(_T("OptionPanel"));
  H3(_("The option panel"));
  IMG(_T("images/OptionPanel.jpg"));
  P(_("The option panel pops up when you click on the big arrow button. If you move the mouse over any of its buttons, a tooltip will show up giving you more information."));

  // -------------------------------------------------
  // Importing several shortcuts automatically
  // -------------------------------------------------
  AddAnchor(_T("Import"));
  H3(_("Importing several shortcuts automatically"));
  P(_("It is possible to automatically import shortcuts into Appetizer from various locations, including the Windows 'Start menu', the 'Quick Launch' toolbar, or the PortableApps folder. To do so, click on [images/ImportButton.jpg] in the [#OptionPanel option panel] and select where you would like to import shortcuts from, then click 'Start'."));

  // -------------------------------------------------
  // Launching several application simultaneously
  // -------------------------------------------------
  AddAnchor(_T("Multilaunch"));
  H3(_("Launching several application simultaneously"));
  P(_("Appetizer provides a functionality to launch several applications at the click of a button. This is equivalent to the Startup menu on Windows, except that it launches the app on your portable drive. To use this 'Multi-launch' group, follow these steps:"));
  StartList();
  LI(_("Right-click on any icon and select 'Multi-launch group' from the context menu"));
  LI(_("You can add as many shortcuts as you wish"));
  LI(_("To trigger the 'Multi-launch' group, open the [#OptionPanel option panel] and click on the 'Multi-launch' button: [images/Multilaunch.jpg]"));
  EndList();

  // *******************************************************************************
  // PLUGINS
  // *******************************************************************************

  AddAnchor(_T("Plugins"));
  H2(_("Plugins"));
  P(_("Appetizer supports a plugin system that allows easily adding new functionalities and customizing the application to your needs."));

  // -------------------------------------------------
  // Adding new plugins
  // -------------------------------------------------

  AddAnchor(_T("AddingPlugins"));
  H3(_("Adding a plugin"));
  P(_("To add a plugin, follow these steps:"));
  StartList();
  LI(_("Open the [#Configuring Configuration dialog]."));
  LI(_("Open the 'Plugin' tab."));
  LI(_("Click the 'Install...' button and open the plugin's .zpl package."));
  LI(_("If everything went well, you should see a message saying that the plugin was successfully installed. However, note that it will only be active the next time Appetizer is started."));
  EndList();

  // -------------------------------------------------
  // Creating a plugin
  // -------------------------------------------------
  AddAnchor(_T("CreatingPlugin"));
  H3(_("Creating a plugin"));
  P(_("Information on how to create a plugin is available on [http://app.etizer.org/wiki/creating-a-plugin Appetizer's website]"));

  // *******************************************************************************
  // CONFIGURING APPETIZER
  // *******************************************************************************

  AddAnchor(_T("Configuring"));
  H2(_("Configuring Appetizer"));
  P(_("The configuration dialogue is accessible by clicking on the 'Configuration' button in the [#OptionPanel option panel]. The description of each setting is given below:"));

  AddAnchor(_T("ConfiguringGeneral"));

  // -------------------------
  // General
  // -------------------------
  H3(_("General"));
  StartList();
  LI(_("[b]Language:[/b] Select your language here. If you wish to contribute and translate Appetizer in your own language, please [#Translating follow this link]."));  
  LI(_("[b]Always on top:[/b] If this is selected the bar will always remain on top of the other windows."));
  LI(_("[b]Allow only one instance of Appetizer at a time:[/b] If this is selected, only one instance of Appetizer can run at a time."));
  LI(_("[b]Install autorun file:[/b] Clicking this button will install an autorun file on your removable drive. This will allow Appetizer to automatically start when you insert the drive. However, note that in some instances Windows may prevent the autorun from being executed, for example for security reason or because the computer is set that way."));
  LI(_("[b]Check for update:[/b] Click this button to check if a new update is available."));
  EndList();

  // -------------------------
  // Appearance
  // -------------------------
  AddAnchor(_T("ConfiguringAppearance"));
  H3(_("Appearance"));
  StartList();
  LI(_("[b]Icon size:[/b] Choose the size of the icons."));
  LI(_("[b]Orientation:[/b] The bar can be vertically or horizontally orientated."));
  LI(_("[b]Skin:[/b] Choose one of the available skins."));
  EndList();

  // -------------------------
  // Operations
  // -------------------------
  AddAnchor(_T("ConfiguringOperations"));
  H3(_("Operations"));
  StartList();
  LI(_("[b]Auto-hide after launching an application:[/b] Select this option to have Appetizer hides itself each time you launch an application."));
  LI(_("[b]When ejecting the drive, close the apps that are locking it:[/b] If this option is selected, all the apps that are open on your removable drive will be closed when you click on the 'Eject' button."));
  LI(_("[b]Run multi-launch group on startup:[/b] Tick off this option to automatically run the [#Multilaunch multi-launch group] on startup."));
  LI(_("[b]'Close' button minimizes to System Tray:[/b] By default, the application is minimized to the System Tray when the 'Close' button is clicked. Tick off this option to make the 'Close' button actually close the app."));
  LI(_("[b]Hot key to hide / show the bar:[/b] Select the hot key to hide / show the bar. Select 'none' to disable it."));
  EndList();

  // -------------------------
  // Import
  // -------------------------
  AddAnchor(_T("ConfiguringImport"));
  H3(_("Import"));
  StartList();
  LI(_("[b]Exclude these items from the import operations:[/b] Normally, when importing shortcuts using the [#Import import tool], all the executables are added to the dock. If you wish to exclude certain files, add them to this list. The item names may be specified with [http://www.computerhope.com/jargon/w/wildcard.htm wildcards]. Note that this list is also automatically populated whenever you remove a shortcut from the dock."));
  EndList();
	
  // -------------------------
  // Plugins
  // -------------------------
  AddAnchor(_T("ConfiguringPlugins"));
  H3(_("Plugins"));
  P(_("This tab displays the plugins that are currently installed along with their status."));
  StartList();
  LI(_("[b]Enable / Disable buttons:[/b] Click these buttons to enable / disable the selected plugin."));
  LI(_("[b]Install...:[/b] Click to [#AddingPlugins install a new plugin]."));
  EndList();	

  // *******************************************************************************
  // OTHER TIPS
  // *******************************************************************************
  H2(_("Other tips"));
  StartList();
  LI(_("You can resize the dock by clicking and dragging its bottom right corner."));
  LI(_("You can move it by clicking anywhere on the icon panel and dragging."));
  LI(_("The bar will snap to the borders of the screens as you move it."));
  EndList();

  // *******************************************************************************
  // TRANSLATING APPETIZER
  // *******************************************************************************
  AddAnchor(_T("Translating"));
  H2(_("Translating Appetizer"));
  P(wxString::Format(_("If Appetizer is not available in your own language, you can easily create your own translation. Please [%s follow this link] for more information."), _T("http://app.etizer.org/translations/")));

  // *******************************************************************************
  // MORE LINKS
  // *******************************************************************************
  AddAnchor(_T("Links"));
  H2(_("Support and links"));
  P(wxString::Format(_("Official home page: %s"), _T("[http://app.etizer.org http://app.etizer.org]")));
  P(wxString::Format(_("Project home page: %s"), _T("[https://sourceforge.net/projects/appetizer https://sourceforge.net/projects/appetizer]")));
  P(wxString::Format(_("Some information on how to create a plugin: %s"), _T("[http://app.etizer.org/wiki/creating-a-plugin http://app.etizer.org/wiki/creating-a-plugin]")));
  P(wxString::Format(_("Beta versions and preleases are usually on [%s PortableApps Beta Testing forum]"), _T("http://portableapps.com/forums/development/beta_testing")));
  P(wxString::Format(_("For bug reports, suggestions, comments or translations, please contact %s"), imayle));//wxString::Format(_T("<a href=\"mailto:%s\">%s</a> or post on the beta forum."), imayle, imayle)));

  AddStringLn(_T("</body>"));
  AddStringLn(_T("</html>"));

  return gCurrentString;
}
예제 #23
0
파일: main.c 프로젝트: cfwprpht/REBUG-4.21
#define IS_CFW			0
#endif

#define MAKE_VERSION(cobra, fw, type) ((cobra&0xFF) | ((fw&0xffff)<<8) | ((type&0x1)<<24))

typedef struct
{
	uint32_t address;
	uint32_t data;
} Patch;


static Patch kernel_patches[] =
{
	{ patch_data1_offset, 0x01000000 },	
	{ patch_func8 + patch_func8_offset1, LI(R3, 0) }, // force lv2open return 0
	// disable calls in lv2open to lv1_send_event_locally which makes the system crash
	{ patch_func8 + patch_func8_offset2, NOP },
	{ patch_func9 + patch_func9_offset, NOP }, // 4.30 - watch: additional call after
	// psjailbreak, PL3, etc destroy this function to copy their code there.
	// We don't need that, but let's dummy the function just in case that patch is really necessary
	{ mem_base2, LI(R3, 1) },
	{ mem_base2 + 4, BLR },		
	// sys_sm_shutdown, for ps2 let's pass to copy_from_user a fourth parameter
	{ shutdown_patch_offset, MR(R6, R31) },
	{ module_sdk_version_patch_offset, NOP },
	// User thread prio hack (needed for netiso)	
	{ user_thread_prio_patch, NOP },
	{ user_thread_prio_patch2, NOP },	
};