mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
verbose lpt logging
This commit is contained in:
@@ -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,15 +25,21 @@ OutPortType OutPort;
|
||||
|
||||
bool TLPT::Connect(int port)
|
||||
{
|
||||
WriteLog("lpt: trying to connect lpt, port " + std::to_string(port) + "...");
|
||||
|
||||
// ladowanie dll-ki
|
||||
hDLL = LoadLibrary("inpout32.dll");
|
||||
if (hDLL)
|
||||
{
|
||||
WriteLog("lpt: inpout32 loaded");
|
||||
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);
|
||||
else
|
||||
{
|
||||
WriteLog("lpt: failed to load inpout32");
|
||||
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ą
|
||||
switch (address) // nie dotyczy 0x3BC
|
||||
@@ -45,10 +52,14 @@ bool TLPT::Connect(int port)
|
||||
case 0xBD00:
|
||||
OutPort(address + 0x006, 0); // 0xBC06? czysta improwizacja
|
||||
}
|
||||
|
||||
WriteLog("lpt: port opened successfully");
|
||||
|
||||
return OutPort != 0;
|
||||
};
|
||||
|
||||
void TLPT::Out(int x)
|
||||
{ // wysłanie bajtu do portu
|
||||
WriteLog("lpt: sending data: " + std::to_string(x), logtype::lptdebug);
|
||||
OutPort(address, x);
|
||||
};
|
||||
|
||||
9
Logs.h
9
Logs.h
@@ -12,10 +12,11 @@ http://mozilla.org/MPL/2.0/.
|
||||
|
||||
enum logtype : unsigned int {
|
||||
|
||||
generic = 0x1,
|
||||
file = 0x2,
|
||||
model = 0x4,
|
||||
texture = 0x8
|
||||
generic = (1 << 0),
|
||||
file = (1 << 1),
|
||||
model = (1 << 2),
|
||||
texture = (1 << 3),
|
||||
lptdebug = (1 << 4)
|
||||
};
|
||||
|
||||
void WriteLog( const char *str, logtype const Type = logtype::generic );
|
||||
|
||||
Reference in New Issue
Block a user