Ejemplo n.º 1
0
/**
 * @brief Lock Surface to Modify Pixels
 */
void SurfaceManager::lockSurface(int surfaceType)
{
    if(SDL_MUSTLOCK(m_surfaceList[surfaceType]->getSurface()))
    {
        if(SDL_LockSurface(m_surfaceList[surfaceType]->getSurface()) < 0)
        {
            SDL_Log("lockSurface(): %s", SDL_GetError());
            assert(false);
        }
    }
}
Ejemplo n.º 2
0
void Android_OnTouch(int touch_device_id_in, int pointer_finger_id_in, int action, float x, float y, float p)
{
    SDL_TouchID touchDeviceId = 0;
    SDL_FingerID fingerId = 0;
    int window_x, window_y;

    if (!Android_Window) {
        return;
    }

    touchDeviceId = (SDL_TouchID)touch_device_id_in;
    if (SDL_AddTouch(touchDeviceId, "") < 0) {
        SDL_Log("error: can't add touch %s, %d", __FILE__, __LINE__);
    }

    fingerId = (SDL_FingerID)pointer_finger_id_in;
    switch (action) {
        case ACTION_DOWN:
        case ACTION_POINTER_1_DOWN:
            if (!leftFingerDown) {
                Android_GetWindowCoordinates(x, y, &window_x, &window_y);

                /* send moved event */
                SDL_SendMouseMotion(NULL, SDL_TOUCH_MOUSEID, 0, window_x, window_y);

                /* send mouse down event */
                SDL_SendMouseButton(NULL, SDL_TOUCH_MOUSEID, SDL_PRESSED, SDL_BUTTON_LEFT);

                leftFingerDown = fingerId;
            }
            SDL_SendTouch(touchDeviceId, fingerId, SDL_TRUE, x, y, p);
            break;
        case ACTION_MOVE:
            if (!leftFingerDown) {
                Android_GetWindowCoordinates(x, y, &window_x, &window_y);

                /* send moved event */
                SDL_SendMouseMotion(NULL, SDL_TOUCH_MOUSEID, 0, window_x, window_y);
            }
            SDL_SendTouchMotion(touchDeviceId, fingerId, x, y, p);
            break;
        case ACTION_UP:
        case ACTION_POINTER_1_UP:
            if (fingerId == leftFingerDown) {
                /* send mouse up */
                SDL_SendMouseButton(NULL, SDL_TOUCH_MOUSEID, SDL_RELEASED, SDL_BUTTON_LEFT);
                leftFingerDown = 0;
            }
            SDL_SendTouch(touchDeviceId, fingerId, SDL_FALSE, x, y, p);
            break;
        default:
            break;
    }
}
Ejemplo n.º 3
0
void HudLayer::pauseGame(IMainGame* game, Music music) {
	SDL_Log("Game Paused");
	if (game->checkPaused() == false) {
		game->setPaused();
		music.audioPauseBG();
	}
	else {
		game->setRunning();
		music.audioResumeBG();
	}
}
Ejemplo n.º 4
0
FontManager::~FontManager()
{
    for(auto kv : fonts)
    {
        SDL_Log("Releasing font %s", kv.first.c_str());
        TTF_CloseFont(kv.second);
    }
    //TODO: Move the ttf out.
    TTF_Quit();

}
Ejemplo n.º 5
0
TTF_Font *FontManager::getFontWithName(const std::string &fontName, const int pointSize)
{
    std::string realName = getRealName(fontName, pointSize);
    std::map<std::string, TTF_Font *>::iterator finder = fonts.find(realName);
    if(finder == fonts.end())
    {
        SDL_Log("Couldn't load font: %s, loading now", fontName.c_str());
        loadFontWithName(fontName, pointSize);
    }
    return fonts.at(realName);
}
Ejemplo n.º 6
0
void jeti_exit (void) {
	if ( sdl_thread_serial_jeti != NULL ) {
		SDL_Log("jeti: wait thread\n");
		SDL_WaitThread(sdl_thread_serial_jeti, NULL);
		sdl_thread_serial_jeti = NULL;
	}
	if (jeti_serial_fd >= 0) {
		close(jeti_serial_fd);
		jeti_serial_fd = -1;
	}
}
Ejemplo n.º 7
0
uint8_t jeti_init (char *mdevice, uint32_t baud) {
	strncpy(jeti_line1, "--- Jeti Box ---", 16);
	strncpy(jeti_line2, " wait for data  ", 16);
	SDL_Log("jeti: init\n");
	jeti_thread_running = 1;
	SDL_Log("jeti: init serial port...\n");
	jeti_serial_fd = serial_open9b(mdevice, baud);
	if (jeti_serial_fd != -1) {
#ifdef SDL2
		sdl_thread_serial_jeti = SDL_CreateThread(thread_serial_jeti, NULL, NULL);
#else
		sdl_thread_serial_jeti = SDL_CreateThread(thread_serial_jeti, NULL);
#endif
		if ( sdl_thread_serial_jeti == NULL ) {
			fprintf(stderr, "* Unable to create thread_serial_jeti: %s\n", SDL_GetError());
			return 1;
		}
	}
	return 0;
}
Ejemplo n.º 8
0
static int SDLCALL
button_messagebox(void *eventNumber)
{
    const SDL_MessageBoxButtonData buttons[] = {
        {
            SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT,
            0,
            "OK"
        },{
            SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT,
            1,
            "Cancel"
        },
    };

    SDL_MessageBoxData data = {
        SDL_MESSAGEBOX_INFORMATION,
        NULL, /* no parent window */
        "Custom MessageBox",
        "This is a custom messagebox",
        2,
        NULL,/* buttons */
        NULL /* Default color scheme */
    };

    int button = -1;
    int success = 0;
    data.buttons = buttons;
    if (eventNumber) {
        data.message = "This is a custom messagebox from a background thread.";
    }

    success = SDL_ShowMessageBox(&data, &button);
    if (success == -1) {
        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s\n", SDL_GetError());
        if (eventNumber) {
            SDL_UserEvent event;
            event.type = (intptr_t)eventNumber;
            SDL_PushEvent((SDL_Event*)&event);
            return 1;
        } else {
            quit(2);
        }
    }
    SDL_Log("Pressed button: %d, %s\n", button, button == -1 ? "[closed]" : button == 1 ? "Cancel" : "OK");

    if (eventNumber) {
        SDL_UserEvent event;
        event.type = (intptr_t)eventNumber;
        SDL_PushEvent((SDL_Event*)&event);
    }

    return 0;
}
Ejemplo n.º 9
0
void Effect::logError(const std::string& msg)
{
    GLint length;
    glGetProgramiv(id, GL_INFO_LOG_LENGTH, &length);
    if (length > 0)
    {
        auto log = std::unique_ptr<GLchar>(new GLchar[length]);
        glGetProgramInfoLog(id, length, &length, log.get());
        SDL_Log("%s:\n%s", msg.c_str(), log.get());
    }
}
Ejemplo n.º 10
0
static void
test_sort(const char *desc, int *nums, const int arraylen)
{
    int i;
    int prev;

    SDL_Log("test: %s arraylen=%d", desc, arraylen);

    SDL_qsort(nums, arraylen, sizeof (nums[0]), num_compare);

    prev = nums[0];
    for (i = 1; i < arraylen; i++) {
        const int val = nums[i];
        if (val < prev) {
            SDL_Log("sort is broken!");
            return;
        }
        prev = val;
    }
}
Ejemplo n.º 11
0
bool Texture_LockTexture(Texture* texture)
{
	bool success = true;

	if (texture->pixels != nullptr)
	{
		SDL_Log("Texture already locked!\n");
		success = false;
	}
	else
	{
		if (SDL_LockTexture(texture->texture, NULL, &texture->pixels, &texture->pitch) != 0)
		{
			SDL_Log("Unable to lock texture! %s\n", SDL_GetError());
			success = false;
		}
	}

	return success;
}
Ejemplo n.º 12
0
int _tmain(int argc, _TCHAR* argv[])
{
    if(!demo.init())
    {
        SDL_Log("Engine Init failed!");
    }

    demo.run();

    return 0;
}
Ejemplo n.º 13
0
Display::Display(float &WIDTH, float &HEIGHT, std::string title, bool fullscreen)
{
    SDL_Init(SDL_INIT_EVERYTHING);

    SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
	SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);

    SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
    SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
    SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
    SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
    SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, 32);
    SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
    SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);

    SDL_GL_SetSwapInterval(0);
    SDL_ShowCursor(0);

    if(fullscreen){
        SDL_DisplayMode dm;

        if (SDL_GetDesktopDisplayMode(0, &dm) != 0){
            SDL_Log("SDL_GetDesktopDisplayMode failed: %s", SDL_GetError());
        }

        this->width = dm.w;
        this->height = dm.h;

        WIDTH = this->width;
        HEIGHT = this->height;
    }else{
        this->width = WIDTH;
        this->height = HEIGHT;
    }

    window = SDL_CreateWindow(title.c_str(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, WIDTH, HEIGHT, SDL_WINDOW_OPENGL | (fullscreen ? SDL_WINDOW_FULLSCREEN : SDL_WINDOW_RESIZABLE));
    glContext = SDL_GL_CreateContext(window);

    GLenum status = glewInit();

    if(status != GLEW_OK){
        std::cerr << "Glew failed to initialize !" << std::endl;
    }

    isWindowClosed = false;
    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_LEQUAL);
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    glViewport(0.0f, 0.0f, WIDTH, HEIGHT);
    lastFrameTime = SDL_GetTicks();

    oneFrameDuration = 1000.0f / (float)MAX_FPS;
}
Ejemplo n.º 14
0
static void
print_devices(int iscapture)
{
    const char *typestr = ((iscapture) ? "capture" : "output");
    int n = SDL_GetNumAudioDevices(iscapture);

    SDL_Log("%s devices:\n", typestr);

    if (n == -1)
        SDL_Log("  Driver can't detect specific %s devices.\n\n", typestr);
    else if (n == 0)
        SDL_Log("  No %s devices found.\n\n", typestr);
    else {
        int i;
        for (i = 0; i < n; i++) {
            SDL_Log("  %s\n", SDL_GetAudioDeviceName(i, iscapture));
        }
        SDL_Log("\n");
    }
}
Ejemplo n.º 15
0
		SDL_Texture* FileLoaderSdlTexture(std::string szFilePath)
		{
			//Load the texture
			SDL_Texture* pTex = IMG_LoadTexture(CAsset::Get()->GetSdlRenderer(), szFilePath.c_str());
			if (pTex == NULL)
			{
				SDL_Log("Error - IMG_LoadTexture - %s.\n", SDL_GetError());
				assert(false);
			}
			return pTex;
		}
Ejemplo n.º 16
0
/**
 * @brief Handle Converting Surface and Adding to SurfaceManager.
 * @param surface
 */
void SurfaceManager::convertAndAdd(int surfaceType, surface_ptr surface)
{
    // Convert the Pixel Format.
    if(surface->exists())
    {
        if(!surface->convert())
        {
            SDL_Log("Unable to create charSurface");
            assert(false);
        }

        // Success, add the Surface to the Manager
        addSurface(surfaceType, surface);
    }
    else
    {
        SDL_Log("Unable to create charSurface");
        assert(false);
    }
}
Ejemplo n.º 17
0
int KW_ProcessEvents(KW_GUI * gui) {
  int i = 0;
  SDL_LockMutex(gui->evqueuelock);  
  for (i = 0; i < gui->evqueuesize; i++) {
    SDL_Event * event = gui->evqueue + i;
    switch (event->type) {
      case SDL_MOUSEMOTION:
        MouseMoved(gui, event->motion.x, event->motion.y, event->motion.xrel, event->motion.yrel);
        break;
      case SDL_MOUSEBUTTONDOWN:
        MousePressed(gui, event->button.x, event->button.y, event->button.button);
        break;
        
      case SDL_MOUSEBUTTONUP:
        MouseReleased(gui, event->button.x, event->button.y, event->button.button);
        break;
        
      case SDL_TEXTINPUT:
        SDL_Log("Got a textready: %s\n", event->text.text);
        TextInputReady(gui, event->text.text);
        break;
        
      case SDL_TEXTEDITING:
        SDL_Log("Got a textediting: %d %d %d %s\n", event->edit.start, event->edit.length, event->edit.type, event->edit.text);
        break;
        
      case SDL_KEYDOWN:
        KeyDown(gui, event->key.keysym.sym, event->key.keysym.scancode);
        break;
      case SDL_KEYUP:
        KeyUp(gui, event->key.keysym.sym, event->key.keysym.scancode);
        break;      
      default:
        break;
    }
  }
  gui->evqueuesize = 0;
  SDL_UnlockMutex(gui->evqueuelock);
  
  return 0;
}
Ejemplo n.º 18
0
static SDL_HitTestResult SDLCALL
hitTest(SDL_Window *window, const SDL_Point *pt, void *data)
{
    int i;
    int w, h;

    for (i = 0; i < numareas; i++) {
        if (SDL_PointInRect(pt, &areas[i])) {
            SDL_Log("HIT-TEST: DRAGGABLE\n");
            return SDL_HITTEST_DRAGGABLE;
        }
    }

    SDL_GetWindowSize(window, &w, &h);

    #define REPORT_RESIZE_HIT(name) { \
        SDL_Log("HIT-TEST: RESIZE_" #name "\n"); \
        return SDL_HITTEST_RESIZE_##name; \
    }

    if (pt->x < RESIZE_BORDER && pt->y < RESIZE_BORDER) {
        REPORT_RESIZE_HIT(TOPLEFT);
    } else if (pt->x > RESIZE_BORDER && pt->x < w - RESIZE_BORDER && pt->y < RESIZE_BORDER) {
        REPORT_RESIZE_HIT(TOP);
    } else if (pt->x > w - RESIZE_BORDER && pt->y < RESIZE_BORDER) {
        REPORT_RESIZE_HIT(TOPRIGHT);
    } else if (pt->x > w - RESIZE_BORDER && pt->y > RESIZE_BORDER && pt->y < h - RESIZE_BORDER) {
        REPORT_RESIZE_HIT(RIGHT);
    } else if (pt->x > w - RESIZE_BORDER && pt->y > h - RESIZE_BORDER) {
        REPORT_RESIZE_HIT(BOTTOMRIGHT);
    } else if (pt->x < w - RESIZE_BORDER && pt->x > RESIZE_BORDER && pt->y > h - RESIZE_BORDER) {
        REPORT_RESIZE_HIT(BOTTOM);
    } else if (pt->x < RESIZE_BORDER && pt->y > h - RESIZE_BORDER) {
        REPORT_RESIZE_HIT(BOTTOMLEFT);
    } else if (pt->x < RESIZE_BORDER && pt->y < h - RESIZE_BORDER && pt->y > RESIZE_BORDER) {
        REPORT_RESIZE_HIT(LEFT);
    }

    SDL_Log("HIT-TEST: NORMAL\n");
    return SDL_HITTEST_NORMAL;
}
Ejemplo n.º 19
0
void KeyboardEventLog(const SDL_Event * event)
{
	switch (event->key.keysym.sym) {
		case SDLK_UP:
			SDL_Log("Physical UP key has been press down");
			break;
		case SDLK_DOWN:
			SDL_Log("Physical DOWN key has been press down");

			break;
		case SDLK_LEFT:
			SDL_Log("Physical LEFT key has been press down");
			break;
		case SDLK_RIGHT:
			SDL_Log("Physical RIGHT key has been press down");
			break;
		default:
			SDL_Log("Undefined key has been press down");
			break;
	}
}
Ejemplo n.º 20
0
void mavlink_exit (void) {
	udp_running = 0;
	if (thread_udp != NULL) {
		SDL_Log("mavlink: wait udp thread\n");
		SDL_WaitThread(thread_udp, NULL);
		thread_udp = NULL;
	}
	if (serial_fd_mavlink >= 0) {
		close(serial_fd_mavlink);
		serial_fd_mavlink = -1;
	}
}
Ejemplo n.º 21
0
/**
 * @brief Update The Texture (Streaming)
 * @param texture
 * @param rect
 * @param surface
 */
void WindowManager::updateTexture(SDL_Texture *texture,
                                  SDL_Rect *rect,
                                  SDL_Surface *surface)
{
    if(SDL_UpdateTexture(texture,
                         rect,
                         surface->pixels,
                         surface->pitch) < 0)
    {
        SDL_Log("updateTexture(): %s", SDL_GetError());
    }
}
Ejemplo n.º 22
0
void Boid::AddTargetForCollisionAvoidance(Entity* target)
{
	if (numTargets < MAX_NUMBER_TARGETS)
	{
		targets[numTargets] = target;
		++numTargets;
	}
	else
	{
		SDL_Log("Target Array reached max number of targets.");
	}
}
Ejemplo n.º 23
0
   //==///////////////////////////////////////////////////////////////////
   //
   ///
   /// Init purchase for a product
   ///
   /// \param
   ///
   /// \return
   ///
   //==///////////////////////////////////////////////////////////////////
   void XFBillingManagerAndroid :: InitPurchase(const string &pProductID)
   {
      SDL_Log("FILLMYBLANK Initiating purchase");
      JNIEnv *aEnv = (JNIEnv *)SDL_AndroidGetJNIEnv();
      //XFOsAndroidManageLocalRef aLocalRef(aEnv);

      jclass aActivityClass = aEnv->FindClass(mClassPath.c_str());

      string pFuncType = string("()L") + mClassPath + ";";
      jmethodID aStaticMid = aEnv->GetStaticMethodID(aActivityClass, "GetActivity", pFuncType.c_str());
      jobject aActivity =  aEnv->CallStaticObjectMethod(aActivityClass, aStaticMid);

      SDL_Log("FILLMYBLANK Got Activity");

      jmethodID aJavaMethodID = aEnv->GetMethodID(aActivityClass, "XFBillingInitPurchase", "(Ljava/lang/String;I)V");

      jstring aJStr = aEnv->NewStringUTF(pProductID.c_str());

      SDL_Log("Calling XFBillingInitPurchase");
      aEnv->CallVoidMethod(aActivity, aJavaMethodID, aJStr, this);
   }
Ejemplo n.º 24
0
bool Sound::Load(const char* fileName, class AssetCache* cache)
{
	mData = Mix_LoadWAV(fileName);
	
	if (!mData)
	{
		SDL_Log("Failed to load sound %s", fileName);
		return false;
	}

	return true;
}
Ejemplo n.º 25
0
static SDL_hapticlist_item *
HapticByDevId (int device_id)
{
    SDL_hapticlist_item *item;
    for (item = SDL_hapticlist; item != NULL; item = item->next) {
        if (device_id == item->device_id) {
            SDL_Log("=+=+=+=+=+= HapticByDevId id [%d]", device_id);
            return item;
        }
    }
    return NULL;
}
Ejemplo n.º 26
0
int
main(int argc, char *argv[])
{
    int i;

    /* Enable standard application logging */
    SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);

    SDL_assert(SDL_arraysize(cursorNames) == SDL_NUM_SYSTEM_CURSORS);

    /* Initialize test framework */
    state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
    if (!state) {
        return 1;
    }
    for (i = 1; i < argc;) {
        int consumed;

        consumed = SDLTest_CommonArg(state, i);
        if (consumed == 0) {
            consumed = -1;
        }
        if (consumed < 0) {
            SDL_Log("Usage: %s %s\n", argv[0], SDLTest_CommonUsage(state));
            quit(1);
        }
        i += consumed;
    }
    if (!SDLTest_CommonInit(state)) {
        quit(2);
    }

    for (i = 0; i < state->num_windows; ++i) {
        SDL_Renderer *renderer = state->renderers[i];
        SDL_SetRenderDrawColor(renderer, 0xA0, 0xA0, 0xA0, 0xFF);
        SDL_RenderClear(renderer);
    }
 
    /* Main render loop */
    done = 0;
#ifdef __EMSCRIPTEN__
    emscripten_set_main_loop(loop, 0, 1);
#else
    while (!done) {
        loop();
    }
#endif
    SDL_FreeCursor(cursor);

    quit(0);
    /* keep the compiler happy ... */
    return(0);
}
Ejemplo n.º 27
0
void
closemutex(int sig)
{
    SDL_threadID id = SDL_ThreadID();
    int i;
    SDL_Log("Process %lu:  Cleaning up...\n", id == mainthread ? 0 : id);
    doterminate = 1;
    for (i = 0; i < 6; ++i)
        SDL_WaitThread(threads[i], NULL);
    SDL_DestroyMutex(mutex);
    exit(sig);
}
Ejemplo n.º 28
0
void update_text()
{
    if ( g_game.practicing ) {
        open_course_data_t *data;
        data = (open_course_data_t*) get_list_elem_data( cur_elem );
        textarea_set_text( desc_ta, data->description );
		button_set_text(course_title_label, data->name);
		SDL_Log("update_text practice=%s", data->course);
		button_set_text(play_button, get_race_text());
		refresh_scores_for_course(data->course);
    } else {
        race_data_t *data;

        data = (race_data_t*) get_list_elem_data( cur_elem );
        textarea_set_text( desc_ta, data->description );
		button_set_text(course_title_label, data->name);
		SDL_Log("update_text race=%s", data->course);
		button_set_text(play_button, get_race_text());
		refresh_scores_for_course(data->course);
    }
}
Ejemplo n.º 29
0
int mavlink_udp (void *data) {
	SDL_Log("mavlink: init udp thread\n");
	mavlink_message_t msg;
	mavlink_status_t status;
	char buf[UDP_BUFLEN];

	if ((s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1) {
		SDL_Log("mavlink: socket error\n");
		return 0;
	}

	int flags = fcntl(s, F_GETFL);
	flags |= O_NONBLOCK;
	fcntl(s, F_SETFL, flags);

	memset((char *) &si_me, 0, sizeof(si_me));
	si_me.sin_family = AF_INET;
	si_me.sin_port = htons(UDP_PORT);
	si_me.sin_addr.s_addr = htonl(INADDR_ANY);
	if( bind(s , (struct sockaddr*)&si_me, sizeof(si_me) ) == -1) {
		SDL_Log("mavlink: bind error\n");
		return 0;
	}
	while (udp_running == 1) {
		fflush(stdout);
		while ((recv_len = recvfrom(s, buf, UDP_BUFLEN, 0, (struct sockaddr *)&si_other, (socklen_t *)&slen)) != -1) {
			int n = 0;
			for (n = 0; n < recv_len; n++) {
				if(mavlink_parse_char(1, buf[n], &msg, &status)) {
					mavlink_handleMessage(&msg);
					mavlink_udp_active = 1;
				}
			}
		}
		SDL_Delay(1);
	}
	close(s);
	SDL_Log("mavlink: exit udp thread\n");
	return 0;
}
Ejemplo n.º 30
0
static void mavlink_parseDoc (char *docname) {
	xmlDocPtr doc;
	xmlNodePtr cur;
	if (strncmp(docname, "./", 2) == 0) {
		docname += 2;
	}
	char *buffer = NULL;
	int len = 0;
	SDL_RWops *ops_file = SDL_RWFromFile(docname, "r");
	if (ops_file == NULL) {
		SDL_Log("map: Document open failed: %s\n", docname);
		return;
	}
	len = SDL_RWseek(ops_file, 0, SEEK_END);
	SDL_RWseek(ops_file, 0, SEEK_SET);
	buffer = malloc(len);
	SDL_RWread(ops_file, buffer, 1, len);
	doc = xmlParseMemory(buffer, len);
	SDL_RWclose(ops_file);
	free(buffer);
	if (doc == NULL) {
		SDL_Log("mavlink: Document parsing failed: %s\n", docname);
		return;
	}
	cur = xmlDocGetRootElement(doc);
	if (cur == NULL) {
		xmlFreeDoc(doc);
		SDL_Log("mavlink: Document is Empty!!!\n");
		return;
	}
	cur = cur->xmlChildrenNode;
	while (cur != NULL) {
		if ((xmlStrcasecmp(cur->name, (const xmlChar *)"text"))) {
			mavlink_parseParams(doc, cur);
		}
		cur = cur->next;
	}
	xmlFreeDoc(doc);
	return;
}