Programming thread

Anyone know any good starting point/examples/docs for writing pnp device drivers on windows? Language probably doesn't matter since I've dabbled in a bunch of langs and it's going to be about the complexity of a hello world, but c# or c/c++ would be preferred. I have a usb steno pedal that doesn't have 64bit drivers and doesn't register as a hid because the manufacturer is dumb.
Could it be that the pedal is showing up as a keyboard? Have you tried running the driver in 32bit compatibility mode?
 
Why OpenGL? Are you just texturing your screen pixels onto a polygon and pointing the "camera" at it?
You could probably adequately represent sprites using using little quads, though I don't know how you'd do HDMA with that, it'd probably be a pain.
Maybe you could record all HDMA ops done over the course of a frame, and then render the complete frame at the end of the "scan"?
 
I expect no less from the geniuses at Microsoft. I remember reading some blog post saying how old Office files (2003 files like .doc) implemented an entire file system within the file, but they fucked up the B tree or something and so the files were way larger than necessary. I can't find that blog post now but here's Joel Spolsky's Microsoft apologist explanation https://www.joelonsoftware.com/2008...-formats-so-complicated-and-some-workarounds/
Even after reading his article I'm convinced all four of these points are true:
  • are deliberately obfuscated
  • are the product of a demented Borg mind
  • were created by insanely bad programmers
  • and are impossible to read or create correctly.
Having had the pleasure of using FogBugz I'm not sure he sees those things as negatives.
 
  • Feels
Reactions: Marvin
Why OpenGL? Are you just texturing your screen pixels onto a polygon and pointing the "camera" at it?
I was learning OpenGL right before taking on this endeavour and while learning it I was wondering how OpenGL games handle 2D; e.g. Maplestory (don't know if it uses OpenGL, but let's say it does). I wanted to try my hand at it. And yes, I will probably create a texture from each frame's data and draw them on a quad.
 
  • Like
Reactions: Marvin
Could it be that the pedal is showing up as a keyboard? Have you tried running the driver in 32bit compatibility mode?
It's old to the point where it's first-generation USB1 and manifests as a serial port, complete with a VID/PID combo for a generic USB TTL adapter. I'm going to have to snoop it in a Win98 VM to see how the ancient software it uses talks to it.

E: It's literally getting Hayes AT codes for initialization, I feel like someone's intentionally trying to prank me.
 
Last edited:
I was learning OpenGL right before taking on this endeavour and while learning it I was wondering how OpenGL games handle 2D; e.g. Maplestory (don't know if it uses OpenGL, but let's say it does). I wanted to try my hand at it. And yes, I will probably create a texture from each frame's data and draw them on a quad.
That's how you do it. Fix a z-coordinate, replace sprites with textured quads, and use an orthogonal projection matrix. Pretty much all 2D graphics libraries with hardware acceleration have been doing exactly this since we first got hardware acceleration. OpenGL only talks 3D, so if you want to render your 2D world on the graphics card, you need to embed your 2D plane in 3 dimensions.

I believe the story on Windows is similar. In the early days of DirectX, there was a 2D API called DirectDraw, but it got deprecated because anyone wanting to do that sort of 2D with hardware acceleration might as well use Direct3D. But that wasn't the end of the story, because 2D as textured quads isn't the be-all-and-end-all. If you want vector graphics (like the classic flash games) you probably don't want textured quads. And so if you want proper vector graphics, there's now Direct2D on Windows and Cairo cross-platform (though I'm not sure of eithers suitability for game-development).
 
Last edited:
Oh boy. The hell that is 3D to 2D projection and good-looking 2D in 3D is something I could ramble on about endlessly.

The one bit I'll add is that you might want to look into faking ortho in perspective mode rather than using real orthographic rendering unless you have a serious reason why you need a real orthographic projection, as fake ortho means you can use all sorts of rendering tricks that only work with perspective matrices (e.g most things involving lighting or shadowcasting), plus you get parallax scrolling for free. The starting point that you need for this is some simple code to calculate the camera view frustum's far corners at a given depth, which you can then convert into screen-space and turn into a matrix so you can project sprites at that distance.

Also for rendering lots of distinct sprites you probably only want one gigantic texture with all the sprites on it instead of separate textures. There's a ton of free texture atlasing tools that will do this for you at runtime with zero effort beyond feeding in the source sprites and in the really big game engines like Unity or UE this is as simple as turning atlasing on in the project preferences.
 
I think the're just all gay to start with. They want to play it down, like this is something anyone could end up doing, to hid the fact they think it's better to by a woman than a gay man. (or that's what they'd rather be)
wtf, I legitimately thought this was some kind of shitpost video with a guy lipsyncing over a cooperating girl. Turns out it's a she/her on twitch called F1NN5TER. Coulda fuckin' fooled me.
 
I didn't even know who FINN5TER was.
Normal people don't make it an occasion when they cross-dress. They just do and it's no big deal. (Women don't expect you to comment on them wearing a man's flannel shirt or if a man wears a woman's blazer it's all just normal.) Gay trannies cross-dress and it's like they're giving birth. All tranny is just permanent pin-up and gays love pin-up.
 
  • Like
Reactions: Yotsubaaa
Been working on a project in Python that interfaces with REST APIs of some popular sites. Before I dug in and reinvented the wheel, I took a look at how others are doing what I need my project to do, and holy shit. Some of these motherfuckers have their heads so far up their own asses it's almost impressive. I'm damn near 100% sure my code is far from being as efficient/well formed as it could be, but the amount of code on Github that performs basic functions in the most ass-backwards, convoluted ways is astounding.

Furthermore, nobody documents jack shit. When I finish writing code, I usually have to go back and revise my DocStrings to be less verbose, eliminate/restructure comments to not be overly descriptive etc. I document like an absolute motherfucker as I go, because these projects get so big so fast that it becomes impossible for even myself (the original dev) to efficiently recall every detail of how it's all put together while I'm working on writing the damned thing. The readme files for other projects I come across are usually just a super vague "Thing that does other thing" type blurb, and the code itself is usually just method after method with little more than names to go off of. It gets even better when they've somehow decided to follow best practices in breaking out different areas of functionality to different modules, but still don't document shit.

How the fuck do these assholes get anything done themselves, much less expect others to contribute to a project, when the only way to follow what they're doing is by trial and error? I can't fucking stand having to sift through a laundry list of methods, much less modules, just to see how something works so I can try and tweak it or add functionality that's sorely missing. Jesus Christ.

Also, the amount of people actively combating the use of the requests builtin or otherwise jumping immediately to abstraction for no fucking reason is kind of astonishing. As an example, aforementioned builtin includes a method for JSON handling that works fantastically with the json builtin, but idiots keep using random-ass things they found on pip instead. Why would you ever even need to force another goddam dependency into your shit project to make things "easier" for something simple like a basic scraper? Fucking idiots would rather have everyone else install additional software than write a single 2-5 line function. What the hell.

EDIT: As pointed out by garakfan69, requests is a third party module. That being said, it's still kind of the golden standard and for whatever reason people seem to forgo its use in favor of fav more convoluted (and far less documented) shit, which is obnoxious.
 
Last edited:
Also, the amount of people actively combating the use of the requests builtin or otherwise jumping immediately to abstraction for no fucking reason is kind of astonishing. As an example, aforementioned builtin includes a method for JSON handling that works fantastically with the json builtin, but idiots keep using random-ass things they found on pip instead. Why would you ever even need to force another goddam dependency into your shit project to make things "easier" for something simple like a basic scraper? Fucking idiots would rather have everyone else install additional software than write a single 2-5 line function. What the hell.
requests is a third-party module though.
I just use python's builtin urllib.

Also, I'm completely sick of REST APIs. They sound like a good idea but they always make you jump through extra hoops like API keys, often they just present their internal shit to handle AJAX request as their API and it's very awkward to use with bad out-of-date documentation, and sometimes they give you different results than their web frontend for no good reason. I even encountered an "API" that would block any user-agent that wasn't a popular browser - what the fuck is that API even supposed to be for?
I just directly scrape the HTML of the web frontend instead of dealing with this shit and save myself a lot of trouble.
 
Also, I'm completely sick of REST APIs. They sound like a good idea but they always make you jump through extra hoops like API keys, often they just present their internal shit to handle AJAX request as their API and it's very awkward to use with bad out-of-date documentation, and sometimes they give you different results than their web frontend for no good reason. I even encountered an "API" that would block any user-agent that wasn't a popular browser - what the fuck is that API even supposed to be for?
I just directly scrape the HTML of the web frontend instead of dealing with this shit and save myself a lot of trouble.
I don't know what REST API you are speaking of which is giving you all this trouble, but I would still much rather use an API which will give a response in a fixed JSON or XML format than doing screen scraping where everything breaks as soon as the page is redesigned, or maybe just the ID of an element changed. The vast majority of REST APIs I've worked with have worked quite well in that regard, so I'm inclined to believe you've just had some bad luck.
 
requests is a third-party module though.

Shit, you're right. It's so ubiquitous I kind of forgot, to be honest. Either way, it's retarded when someone uses some obscure piece of shit module instead, wherein the only difference other than syntax is that the alternative module does a bunch of shit that's not relevant to the project's needs.

Also, I'm completely sick of REST APIs. They sound like a good idea but they always make you jump through extra hoops like API keys, often they just present their internal shit to handle AJAX request as their API and it's very awkward to use with bad out-of-date documentation, and sometimes they give you different results than their web frontend for no good reason.

Yeah, this is a headache and a half. If you're going to bother having an API, document the motherfucker. Half of the REST APIs you'll encounter in the wild are largely based on one that shipped with another project the site/service was forked from, and it annoys the fuck out of me when they don't even bother to link to the original documentation and instead either don't provide any documentation or offer some half-assed shitty doc they probably copy/pasted from one of their users' posts on the site's forum or some shit.

I even encountered an "API" that would block any user-agent that wasn't a popular browser - what the fuck is that API even supposed to be for?

Sounds like the API was either unfinished, or the creator/maintainer regretted its inclusion and over reacted to some skiddie abusing it at some point.

I just directly scrape the HTML of the web frontend instead of dealing with this shit and save myself a lot of trouble.

I've done that on a few projects, and been tempted to do it on many more, but the current thing I'm working on involves API requests for metadata on media files that is otherwise only available on pages that display said media. This project is meant to scrape said metadata for thousands of files, potentially. In other words, using the API means transferring megabytes vs gigabytes, and the tasks taking seconds vs minutes or even hours. APIs do have their place, though complex JSON is an absolute clusterfuck to (de)serialize and I really fucking wish certain APIs allowed more control to say "Just give me x field/value in a format I can convert to a universal datatype like a list or dictionary without wanting to kill myself".
 
  • Feels
Reactions: byuu
Back