2 registered members (AndrewAMD, 1 invisible),
1,395
guests, and 12
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Acknex.exe with console
[Re: MasterQ32]
#451449
05/06/15 15:42
05/06/15 15:42
|
Joined: Apr 2007
Posts: 3,751 Canada
WretchedSid
Expert
|
Expert
Joined: Apr 2007
Posts: 3,751
Canada
|
Pretty sure I have seen stdio.h somewhere before in Lite-C. Try that one.
Shitlord by trade and passion. Graphics programmer at Laminar Research. I write blog posts at feresignum.com
|
|
|
Re: Acknex.exe with console
[Re: WretchedSid]
#451450
05/06/15 15:45
05/06/15 15:45
|
Joined: Apr 2007
Posts: 3,751 Canada
WretchedSid
Expert
|
Expert
Joined: Apr 2007
Posts: 3,751
Canada
|
Actually fuck it, MasterQ32 is the genius. Just resolve printf() from the standard C library and shadow the Gamestudio printf with that one!
Shitlord by trade and passion. Graphics programmer at Laminar Research. I write blog posts at feresignum.com
|
|
|
Re: Acknex.exe with console
[Re: WretchedSid]
#451456
05/06/15 16:17
05/06/15 16:17
|
Joined: Nov 2007
Posts: 2,568 Germany, BW, Stuttgart
MasterQ32
Expert
|
Expert
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
|
Just tried to get a handle to the original printf function, but something doesn't want me to get it running. I've created a small demo with pure Windows API functions that shows how to write/read from the console:
#include <acknex.h>
#include <windows.h>
#include <stdio.h>
// We need those headers
BOOL WINAPI WriteConsole(
HANDLE hConsoleOutput,
const void *lpBuffer,
DWORD nNumberOfCharsToWrite,
DWORD *lpNumberOfCharsWritten,
void *lpReserved);
BOOL WINAPI ReadConsole(
HANDLE hConsoleInput,
void *lpBuffer,
DWORD nNumberOfCharsToRead,
DWORD *lpNumberOfCharsRead,
void *pInputControl);
function main()
{
// Create console window
AllocConsole();
// Get handles to the input and output console
HANDLE output = GetStdHandle(STD_OUTPUT_HANDLE);
HANDLE input = GetStdHandle(STD_INPUT_HANDLE);
// Write some text
WriteConsole(output, "Hello World!", 12, NULL, NULL);
// Read some text (one line to be exact)
char buffer[128];
DWORD len;
ReadConsole(input, buffer, 127, len, NULL);
buffer[len] = 0;
// Echo result
error(buffer);
}
|
|
|
Re: Acknex.exe with console
[Re: MasterQ32]
#451459
05/06/15 16:39
05/06/15 16:39
|
Joined: May 2008
Posts: 2,113 NRW/Germany
alibaba
Expert
|
Expert
Joined: May 2008
Posts: 2,113
NRW/Germany
|
How cool is that!? Thank you Felix! And thank you too Sidney! The world of winAPI is really scary, but extremely useful! BTW Acknex does not want to accept:
int fprintf (FILE *__stream, const char *__format, ...);
Last edited by alibaba; 05/06/15 16:44.
|
|
|
Re: Acknex.exe with console
[Re: alibaba]
#451466
05/06/15 17:37
05/06/15 17:37
|
Joined: Oct 2007
Posts: 5,210 Ä°stanbul, Turkey
Quad
OP
Senior Expert
|
OP
Senior Expert
Joined: Oct 2007
Posts: 5,210
Ä°stanbul, Turkey
|
Btw, the exe source was the same one in the sdk_Engine folder, only compiled as console app.
the dll source i posted in first page gives you a cprintf function, which is same as printf, you just declare it in lite-c and init it with PRAGMA_API macro(it's not a plugin dll) then do printf = cprintf; somewhere in your lite-c code. (or init printf itself: #define PRAGMA_API printf;dllname:cprintf, or something like that, not sure if that would work though)
also as far as i can remember physx plugin had bunch of printf's in it and if you use the exe compiled as console app, you see all that in your console, so if your project uses physx alot it renders console virtually unusable. But that was years ago they might have already removed those printfs.
For your use case MasterQ's solution could be more useful though.
3333333333
|
|
|
|