16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-17 23:39:18 +02:00

lpt diagnostics, tempomat configuration enhancements, ai cargo train driving logic tweaks, partial ai support for universal controller in diesel-electric vehicles

This commit is contained in:
tmj-fstate
2020-05-23 23:14:54 +02:00
parent 52167f7955
commit 10dabd66c3
10 changed files with 208 additions and 95 deletions

View File

@@ -9,6 +9,7 @@ http://mozilla.org/MPL/2.0/.
#include "stdafx.h"
#include "LPT.h"
#include "Logs.h"
// LPT na USB:
// USB\VID_067B&PID_2305&REV_0200
@@ -24,17 +25,21 @@ OutPortType OutPort;
bool TLPT::Connect(int port)
{
WriteLog( "LPT: trying to access port " + std::to_string(port) );
// ladowanie dll-ki
hDLL = LoadLibrary("inpout32.dll");
if (hDLL)
{
InPort = (InPortType)GetProcAddress(hDLL, "Inp32");
OutPort = (OutPortType)GetProcAddress(hDLL, "Out32");
OutPort = (OutPortType)GetProcAddress(hDLL, "Out32");
}
else
return false; // MessageBox(NULL,"ERROR","Błąd przy ładowaniu pliku",MB_OK);
address =
port; //&0xFFFFFC; //ostatnie 2 bity mają być zerowe -> a niech sobie OUT-ują, gdzie chcą
else
{
WriteLog("LPT: failed to load inpout32");
return false;
}
address = port;
switch (address) // nie dotyczy 0x3BC
{
case 0x0378:
@@ -45,10 +50,13 @@ bool TLPT::Connect(int port)
case 0xBD00:
OutPort(address + 0x006, 0); // 0xBC06? czysta improwizacja
}
WriteLog("LPT: setup complete");
return OutPort != 0;
};
void TLPT::Out(int x)
{ // wysłanie bajtu do portu
OutPort(address, x);
};
};