Changeset 1:36cf4d98558c in xplra


Ignore:
Timestamp:
01/03/13 09:09:43 (11 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Some further development

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • configure.ac

    r0 r1  
    1616
    1717AM_CONDITIONAL([TARGET_API_WIN32], test $_target_win32 -eq 0)
     18AM_CONDITIONAL([TARGET_API_WIN64], test $_target_win32 -eq 0 -a "$host_cpu" = "x86_64")
    1819AM_CONDITIONAL([TARGET_API_POSIX], test $_target_win32 -ne 0)
    1920if test $_target_win32 -eq 0; then
     21   if test "$host_cpu" = "x86_64"; then
     22       AC_DEFINE([TARGET_API_WIN64], [1], [Define if the target is the 64-bit Win32 API.])
     23   fi
    2024   AC_DEFINE([TARGET_API_WIN32], [1], [Define if the target is the Win32 API.])
    2125else
  • src/xplra/ListenThread.cc

    r0 r1  
    3131#include "ListenThread.h"
    3232
    33 #include <XPLMUtilities.h>
     33#include <xplcommon/Util.h>
    3434
    3535//------------------------------------------------------------------------------
     
    3737using xplra::ListenThread;
    3838
     39using xplcommon::Util;
     40
    3941//------------------------------------------------------------------------------
    4042
    4143void ListenThread::run()
    4244{
    43     XPLMDebugString("xplra::ListenThread::run: started\n");
     45    Util::debug("xplra::ListenThread::run: started\n");
    4446
    4547    while(!quitEvent.check() && !quitEvent.failed()) {
     
    4749    }
    4850
    49     XPLMDebugString("xplra::ListenThread::run: quitting\n");
     51    Util::debug("xplra::ListenThread::run: quitting\n");
    5052}
    5153
  • src/xplra/Makefile.am

    r0 r1  
    55if TARGET_API_WIN32
    66AM_CPPFLAGS=-DIBM
    7 AM_LDFLAGS=@XPSDK_LDFLAGS@ -lXPLM -no-undefined
     7AM_LDFLAGS=@XPSDK_LDFLAGS@ -no-undefined
     8if TARGET_API_WIN64
     9AM_LDFLAGS+=-lXPLM_64
     10else
     11AM_LDFLAGS+=-lXPLM
     12endif
    813endif
    914
  • src/xplra/plugin.cc

    r0 r1  
     1// Copyright (c) 2013 by István Váradi
     2
     3// This file is part of XPLRA, a remote-access plugin for X-Plane
     4
     5// Redistribution and use in source and binary forms, with or without
     6// modification, are permitted provided that the following conditions are met:
     7
     8// 1. Redistributions of source code must retain the above copyright notice, this
     9//    list of conditions and the following disclaimer.
     10// 2. Redistributions in binary form must reproduce the above copyright notice,
     11//    this list of conditions and the following disclaimer in the documentation
     12//    and/or other materials provided with the distribution.
     13
     14// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
     15// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     16// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
     17// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
     18// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     19// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     20// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
     21// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     22// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
     23// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     24
     25// The views and conclusions contained in the software and documentation are those
     26// of the authors and should not be interpreted as representing official policies,
     27// either expressed or implied, of the FreeBSD Project.
     28
     29//------------------------------------------------------------------------------
     30
    131#include "ListenThread.h"
     32
     33#include <xplcommon/Util.h>
    234
    335#include <XPLMDefs.h>
     
    1345using xplra::ListenThread;
    1446
     47using xplcommon::Util;
     48
    1549//------------------------------------------------------------------------------
    1650
     51/**
     52 * The thread to use to listen for incoming connections.
     53 */
    1754static ListenThread* listenThread = 0;
    1855
    1956//------------------------------------------------------------------------------
    2057
    21 static void debug(const char* format, ...)
    22 {
    23     va_list ap;
    24     va_start(ap, format);
    25 
    26     char buf[256];
    27     vsnprintf(buf, sizeof(buf), format, ap);
    28 
    29     va_end(ap);
    30 
    31     XPLMDebugString(buf);
    32 }
    33 
    3458PLUGIN_API int XPluginStart(char* outName, char* outSignature,
    3559                            char* outDescription)
    3660{
    37     debug("hu.varadiistvan.xplra called\n");
     61    Util::debug("hu.varadiistvan.xplra called\n");
    3862
    3963    strcpy(outName, "X-Plane Remote Access");
     
    4468}
    4569
    46 // float callback(float elapsedSinceLastCall, float elapsedTimeSinceLastFlightLoop,
    47 //               int counter, void* refcon)
    48 // {
    49 //     debug("hu.varadiistvan.proba.callback called: elapsedSinceLastCall=%f, elapsedTimeSinceLastFlightLoop=%f, counter=%d, refcon=%p\n",
    50 //           elapsedSinceLastCall, elapsedTimeSinceLastFlightLoop,
    51 //           counter, refcon);
    52 //     return 5.0;
    53 // }
     70//------------------------------------------------------------------------------
    5471
    5572PLUGIN_API void XPluginEnable(void)
    5673{
    57     debug("hu.varadiistvan.proba.XPluginEnable called\n");
     74    Util::debug("hu.varadiistvan.xplra.XPluginEnable called\n");
    5875    // XPLMRegisterFlightLoopCallback(&callback, 5.0, 0);
    5976    listenThread = new ListenThread();
     
    6178}
    6279
     80//------------------------------------------------------------------------------
     81
    6382PLUGIN_API void XPluginReceiveMessage(XPLMPluginID inFrom, long inMessage,
    6483                                      void* inParam)
    6584{
    66     debug("hu.varadiistvan.proba.XPluginReceiveMessage called, inFrom=%d, inMessage=%ld, inParam=%p\n",
     85    Util::debug("hu.varadiistvan.xplra.XPluginReceiveMessage called, inFrom=%d, inMessage=%ld, inParam=%p\n",
    6786          inFrom, inMessage, inParam);
    6887}
    6988
     89//------------------------------------------------------------------------------
     90
    7091PLUGIN_API void XPluginDisable(void)
    7192{
    72     debug("hu.varadiistvan.proba.XPluginDisable called\n");
     93    Util::debug("hu.varadiistvan.xplra.XPluginDisable called\n");
    7394    // XPLMUnregisterFlightLoopCallback(&callback, 0);
    7495    if (listenThread!=0) {
     
    7899}
    79100
     101//------------------------------------------------------------------------------
     102
    80103PLUGIN_API void XPluginStop(void)
    81104{
    82     debug("hu.varadiistvan.proba.XPluginStop called\n");
     105    Util::debug("hu.varadiistvan.xplra.XPluginStop called\n");
    83106}
     107
     108//------------------------------------------------------------------------------
     109
     110// Local Variables:
     111// mode: C++
     112// c-basic-offset: 4
     113// indent-tabs-mode: nil
     114// End:
Note: See TracChangeset for help on using the changeset viewer.