Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, 1 invisible), 1,395 guests, and 12 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 3 of 3 1 2 3
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 Offline
Expert
WretchedSid  Offline
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 Offline
Expert
WretchedSid  Offline
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 Offline
Expert
MasterQ32  Offline
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:
Code:
#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);
}



Visit my site: www.masterq32.de
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 Online
Expert
alibaba  Online
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:
Code:
int fprintf (FILE *__stream, const char *__format, ...);


Last edited by alibaba; 05/06/15 16:44.

Professional Edition
A8.47.1
--------------------
http://www.yueklet.de
Re: Acknex.exe with console [Re: alibaba] #451460
05/06/15 16:41
05/06/15 16:41
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
Why is it scary? It's well documented, it's clear, there are plenty of people how know shit.
Just read some stuff here and you'll see what i've done:
https://msdn.microsoft.com/de-de/library/windows/desktop/ms682073(v=vs.85).aspx


Visit my site: www.masterq32.de
Re: Acknex.exe with console [Re: MasterQ32] #451461
05/06/15 16:45
05/06/15 16:45
Joined: May 2008
Posts: 2,113
NRW/Germany
alibaba Online
Expert
alibaba  Online
Expert

Joined: May 2008
Posts: 2,113
NRW/Germany
Well I tried it before, but seems like I´ve searched the wrong pages. There were a lot of uncommented stuff, which is why I got lost in first place.


Professional Edition
A8.47.1
--------------------
http://www.yueklet.de
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 Offline OP
Senior Expert
Quad  Offline 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
Page 3 of 3 1 2 3

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1