Page 1 of 1

Batch native: a collection of dll's for cmd

Posted: 27 Sep 2023 15:57
by mdev123
Batch Native is a collection of DLL's that inject themselves into cmd.exe using rundll32. From there, they work in the background. This allows things like asynchronous input polling for batch games, Discord Rich Presence support or fast map rendering by writing directly into CMD's buffer, async 4 voice mp3 audio playback, and networking on the way. These 5 things I just listed are the first (and right now only) 5 extensions, but more can come in the foreseeable future if there is demand. All code is open source, so anyone is free to create extensions on their own.

The main focus of work right now is the GetInput module, used for, as the name says, getting input. It supports grabbing multiple keys pressed at once, Xbox controllers and mouse position along with click and scroll data. So far it is used mainly by Yeshi in his Geometry DOS and NewEngine projects.

Even though the project is in on and off development for maybe 2 years now, it still most likely contains bugs, and if any of you find one, I'd be eager to have it reported on project's GitHub issues. Or maybe you can even make a fork+pull request and fix it yourself, if you want to. I suspect the Discord Rich Presence module is broken, because of the username change and me using the legacy Discord RPC library, haven't tested though. I am grateful for all feedback.

https://github.com/mdev-new/batch_native
https://github.com/mdev-new/batch_native/releases

Re: Batch native: a collection of dll's for cmd

Posted: 02 Oct 2023 02:44
by shodan
Interesting but I don' t know where to begin with this.

I can program but DLL are beyond me for now.

// YESHIS INSANE, NOT PRETTY **censored** BEGINS HERE
// I DONT WANT TO DO THIS
// i don't like this function. at all.
// basically we're just chugging cpu because microsoft
// decided to make windows utter trash.

DWORD GETINPUT_SUB CALLBACK ModeThread(void* data) {

Code: Select all

while (1) {
		GetConsoleMode(hStdIn, &inputModeRead);
Yes, this is not good for performance.

The microsoft documentation explicitely states that polling window messages will have a really adverse effect on console performance.

My hope would be to have a little tiny deamon doing only the callback, getting callback only from the one threadID of the one console we care about and it should do no processing in the callback loop. Just toggle a boolean and return the callback and go to sleep for at least 50 millisecond

Re: Batch native: a collection of dll's for cmd

Posted: 02 Oct 2023 05:21
by IcarusLives
Personally, I'd like to see a more standardized output from the xbox controllers. Would be really fun to use otherwise.