Jump to content
The simFlight Network Forums

ras78

Members
  • Posts

    11
  • Joined

  • Last visited

Posts posted by ras78

  1. I had a quick look at LUA, seems so simple...to simple :)

    I tryied to port my C code into LUA module. Since I've just to read an offset, have a check and write another offset, the code should be this:

    visibility = ipc.readSW(0x0E8A)
    if visibility<=300 then
    	ipc.writeSW(0x0DDE, 999)
    end
    

    Is it so simple or I miss something? the LUAC compiler create succesfully my out file, I placed it into /modules folder of FS9 and updated the FSUIPC version.

    This should be enough?

  2. Hello, I'm trying to code a dll in order to read the visibility and fill a USRVR5 variabile, thus I'll be able to condition an object in my scenery. Here's the code:

    #include "fsmodule.h"
    #include 
    #include "FSUIPC_User.h"
    
    LINKAGE Linkage =
    {
        //0x000002d9,
        0x00000000,
        module_init,
        module_deinit,
        0,
        0,
        0x900,
        NULL
    };
    
    IMPORTTABLE ImportTable =
    {
        {
            0x00000000, NULL
        }
    };
    
    WORD      LowVis=1;
    UINT_PTR  TimerFSUIPC, VisibilityTimer;
    BYTE      FSUIPCMemory[500];
    
    VOID CALLBACK Visibility(HWND hwnd, UINT uMsg,UINT_PTR idEvent, DWORD dwTime)
    {
       DWORD      dwResult;
       DWORD      IsLowVisibility;
    
       FSUIPC_Read(0x0E8A, 2, (DWORD*)&IsLowVisibility, &dwResult);
       FSUIPC_Process(&dwResult);
    
       //visibility is lower than 3 miles
       if (IsLowVisibility<=300) {
          FSUIPC_Write(0x0DDE, 2, &LowVis, &dwResult);
          FSUIPC_Process(&dwResult);
       }
    }
    
    VOID CALLBACK InitFSUIPC(HWND hwnd, UINT uMsg,UINT_PTR idEvent, DWORD dwTime)
    {
       DWORD dwResult;
       if (FSUIPC_Open2(SIM_ANY, &dwResult, (BYTE*)FSUIPCMemory, 500)) {
          KillTimer(NULL,TimerFSUIPC);
          VisibilityTimer=SetTimer(NULL,1,2000,Visibility);
       }
    
    }
    void FSAPI module_init ()
    {
       TimerFSUIPC=SetTimer (NULL,0,2000,InitFSUIPC);   
    } 
    
    void FSAPI module_deinit ()
    {
       KillTimer (NULL,VisibilityTimer);
       FSUIPC_Close ();
    }
    

    Basically I would fill that variabiles when the visibility is lower/equal than 3 miles. The compiler create succeasfullt my DLL but nothing runs as expected. Is this code correct?

    thanks!

    alberto

  3. Hi guys,

    I'm writing a simply DLL in order to detect visibility distance and condition an object in my scenery. Here's the code:

    #include "fsmodule.h"
    #include 
    #include "FSUIPC_User.h"
    
    
    LINKAGE Linkage =
    {
        //0x000002d9,
        0x00000000,
        module_init,
        module_deinit,
        0,
        0,
        0x900,
        NULL
    };
    
    IMPORTTABLE ImportTable =
    {
        {
            0x00000000, NULL
        }
    };
    
    WORD      LowVis=1;
    UINT_PTR   TimerFSUIPC, VisibilityTimer;
    BYTE      FSUIPCMemory[500];
    
    VOID CALLBACK Visibility(HWND hwnd, UINT uMsg,UINT_PTR idEvent, DWORD dwTime)
    {
       DWORD      dwResult;
       BYTE      IsLowVisibility;
    
        FSUIPC_Write(0x8001, 12, "IKB3BI67TCHEtest.dll", &dwResult);
        FSUIPC_Process(&dwResult);
    
       FSUIPC_Read(0x0E8A, 2, (BYTE*)&IsLowVisibility, &dwResult);
       FSUIPC_Process(&dwResult);
    
       //visibility is lower than 3 miles
       if (IsLowVisibility<=3.0) {
          FSUIPC_Write(0x0DDE, 2, &LowVis, &dwResult);
          FSUIPC_Process(&dwResult);
       }
    }
    
    VOID CALLBACK InitFSUIPC(HWND hwnd, UINT uMsg,UINT_PTR idEvent, DWORD dwTime)
    {
       DWORD dwResult;
       if (FSUIPC_Open2(SIM_ANY, &dwResult, (BYTE*)FSUIPCMemory, 500)) {
          KillTimer(NULL,TimerFSUIPC);
          VisibilityTimer=SetTimer(NULL,1,2000,Visibility);
       }
    
    }
    void FSAPI module_init ()
    {
       TimerFSUIPC=SetTimer (NULL,0,2000,InitFSUIPC);   
    } 
    
    void FSAPI module_deinit ()
    {
       KillTimer (NULL,VisibilityTimer);
       FSUIPC_Close ();
    }

    Basically nothing happens, the DLL should be ok, what's wrong?

    tx!

  4. hello guys,

    I'm trying to create a simple module (DLL) for FS which use Fsuipc for read a couple of offset. Basically I read an offset, get it's value and set another offset. Here's the code:

    #include "fsmodule.h"
    #include 
    #include "FSUIPC_User.h"
    
    
    LINKAGE Linkage =
    {
        0x000002d9,
        module_init,
        module_deinit,
        0,
        0,
        0x800,
        { 0 }
    };
    
    IMPORTTABLE ImportTable =
    {
        {
            0x00000000, NULL
        }
    };
    
    WORD		LowVis=0;
    UINT_PTR	FSUIPCTimer, VisibilityTimer;
    BYTE		FSUIPCMemory[400];
    
    VOID CALLBACK Visibility(HWND hwnd, UINT uMsg,UINT_PTR idEvent, DWORD dwTime)
    {
    	DWORD		dwResult;
    	BYTE		IsLowVisibility;
    
        FSUIPC_Write(0x8001, 12, "IKB3BI67TCHEtest.dll", &dwResult);
        FSUIPC_Process(&dwResult);
    
    	FSUIPC_Read(0x238, 3, (BYTE*)&IsLowVisibility, &dwResult);
    	FSUIPC_Process(&dwResult);
    
    	//visibility is lower than 2 miles
    	//if (IsLowVisibility<=0.02) {
    		FSUIPC_Write(0x0DDE, 1, &LowVis, &dwResult);
    	//	FSUIPC_Process(&dwResult);
    	//}
    }
    
    VOID CALLBACK InitFSUIPC(HWND hwnd, UINT uMsg,UINT_PTR idEvent, DWORD dwTime)
    {
    	DWORD dwResult;
    	if (FSUIPC_Open2(SIM_ANY, &dwResult, (BYTE*)FSUIPCMemory, 500)) {
    		KillTimer(NULL,FSUIPCTimer);
    		VisibilityTimer=SetTimer(NULL,1,2000,Visibility);
    	}
    
    }
    void FSAPI module_deinit ()
    {
    	KillTimer (NULL,VisibilityTimer);
    	FSUIPC_Close ();
    }
    void FSAPI module_init ()
    {
    	FSUIPCTimer=SetTimer (NULL,0,2000,InitFSUIPC);
    }
    

    My C compiler succesfully create my DLL but when I put into \modules folder, fs does not load it. I'm a newbie about dll, I dunno how to debug.

    Any advice?

    thanks!

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.