JNIEXPORT void JNICALL Java_com_enst_mp4box_mp4terminal_run(JNIEnv * env, jobject obj, jstring sCommand) { //CAST_HANDLE(wr); jniLOGV("mp4terminal::start"); /*if (!wr) { jniLOGV("mp4terminal::end : aborted"); return; }*/ jboolean isCopy; const char * sOriginalCommand = (*env)->GetStringUTFChars(env, sCommand, &isCopy); jniLOGV("mp4terminal::command get back ok"); jniLOGV(sOriginalCommand); int iNbArg = 0; int i = 0; char** sConvertedCommandLine; sConvertedCommandLine = ConvertCommandLine( sOriginalCommand, &i ); jniLOGV("Convert command line done"); FILE* ferr = freopen( "/mnt/sdcard/stderrout.txt", "w", stderr ); FILE* fout = freopen( "/mnt/sdcard/stdout.txt", "w", stdout ); mp4boxMain(i, sConvertedCommandLine); (*env)->ReleaseStringUTFChars(env, sCommand, sOriginalCommand); jniLOGV("mp4terminal::end"); gf_fclose(ferr); gf_fclose(fout); }
int main(int argc, char ** argv) { SetupSharedThread::install(); SetupSharedDebug::install(1024); //-- setup foundation SetupSharedFoundation::Data setupFoundationData(SetupSharedFoundation::Data::D_game); setupFoundationData.lpCmdLine = ConvertCommandLine(argc,argv); SetupSharedFoundation::install (setupFoundationData); { //SetupSharedObject::Data data; //SetupSharedObject::setupDefaultGameData(data); //SetupSharedObject::install(data); } SetupSharedCompression::install(); SetupSharedFile::install(32); SetupSharedNetwork::SetupData networkSetupData; SetupSharedNetwork::getDefaultServerSetupData(networkSetupData); SetupSharedNetwork::install(networkSetupData); SetupSharedRandom::install(static_cast<uint32>(time(NULL))); //lint !e1924 !e64 // NULL is a C-Style cast? Os::setProgramName("MetricsServer"); //setup the server ConfigMetricsServer::install(); //set command line std::string cmdLine = setupFoundationData.lpCmdLine; size_t firstArg = cmdLine.find(" ", 0); size_t lastSlash = 0; size_t nextSlash = 0; while(nextSlash < firstArg) { nextSlash = cmdLine.find("/", lastSlash); if(nextSlash == cmdLine.npos || nextSlash >= firstArg) //lint !e1705 static class members may be accessed by the scoping operator (huh?) break; lastSlash = nextSlash + 1; } cmdLine = cmdLine.substr(lastSlash); MetricsServer::setCommandLine(cmdLine); //-- run game NetworkHandler::install(); MetricsServer::install(); MetricsServer::run(); MetricsServer::remove(); NetworkHandler::remove(); SetupSharedFoundation::remove(); return 0; }
int main(int argc, char ** argv) { // dumpPid(argv[0]); SetupSharedThread::install(); SetupSharedDebug::install(1024); //-- setup foundation SetupSharedFoundation::Data setupFoundationData(SetupSharedFoundation::Data::D_game); setupFoundationData.lpCmdLine = ConvertCommandLine(argc,argv); SetupSharedFoundation::install (setupFoundationData); SetupSharedFile::install(false); SetupSharedRandom::install(time(NULL)); SetupSharedNetwork::SetupData networkSetupData; SetupSharedNetwork::getDefaultServerSetupData(networkSetupData); SetupSharedNetwork::install(networkSetupData); SetupSharedNetworkMessages::install(); SetupSwgSharedNetworkMessages::install(); SetupSwgServerNetworkMessages::install(); SetupSharedLog::install("SwgDatabaseServer"); TreeFile::addSearchAbsolute(0); TreeFile::addSearchPath(".",0); //-- setup server ConfigServerDatabase::install (); NetworkHandler::install(); Os::setProgramName("SwgDatabaseServer"); SwgDatabaseServer::install(); //-- run server SwgDatabaseServer::getInstance().run(); NetworkHandler::remove(); SetupSharedLog::remove(); SetupSharedFoundation::remove(); SetupSharedThread::remove(); return 0; }
int main(int argc, char ** argv) { // dumpPid(argv[0]); SetupSharedThread::install(); SetupSharedDebug::install(1024); //-- setup foundation SetupSharedFoundation::Data setupFoundationData(SetupSharedFoundation::Data::D_game); setupFoundationData.lpCmdLine = ConvertCommandLine(argc,argv); SetupSharedFoundation::install (setupFoundationData); SetupSharedCompression::install(); SetupSharedFile::install(false); SetupSharedNetwork::SetupData networkSetupData; SetupSharedNetwork::getDefaultServerSetupData(networkSetupData); SetupSharedNetwork::install(networkSetupData); SetupSharedNetworkMessages::install(); SetupSharedRandom::install(time(NULL)); //lint !e732 loss of sign (of 0!) SetupSharedUtility::Data sharedUtilityData; SetupSharedUtility::setupGameData (sharedUtilityData); SetupSharedUtility::install (sharedUtilityData); Os::setProgramName("PlanetServer"); ConfigPlanetServer::install(); char tmp[92]; sprintf(tmp, "PlanetServer:%d", Os::getProcessId()); SetupSharedLog::install(tmp); //-- run game PlanetServer::run(); SetupSharedLog::remove(); SetupSharedFoundation::remove(); SetupSharedThread::remove(); return 0; }
int main(int argc, char *argv[]) { SetupSharedThread::install(); SetupSharedDebug::install(1024); SetupSharedFoundation::Data setupFoundationData(SetupSharedFoundation::Data::D_game); setupFoundationData.lpCmdLine = ConvertCommandLine(argc, argv); SetupSharedFoundation::install(setupFoundationData); SetupSharedCompression::install(); SetupSharedFile::install(false); SetupSharedNetworkMessages::install(); SetupSharedRandom::install(static_cast<uint32>(time(NULL))); Os::setProgramName("CustomerServiceServer"); ConfigCustomerServiceServer::install(); NetworkHandler::install(); CustomerServiceServer::getInstance().run(); NetworkHandler::remove(); SetupSharedFoundation::remove(); return 0; }