How to remove pcANYWHERE32 v8.0 from Windows XP

…so you naively thought that continuing past the Windows XP compatibility warning and installing pcANYWHERE 8.0 would give you a working pcANYWHERE client but no server?

…and you now have a machine that just boots into a black 640×480 screen which ignores Ctrl+Alt+Delete but does let you move the mouse?

…even if you choose to boot into Safe Mode?

Here’s how I recovered my Windows XP retro-machine without undue pain:

  1. Pull up the “Windows Advanced Options Menu” (Hit F8 after your BIOS hands off to Windows but before the boot logo appears… I just tap it repeatedly.)
  2. Choose “Last Know Good Configuration (your most recent settings that worked)”
  3. You’ll probably get a working boot with auto-login temporarily disabled. I just hit Enter with the username it pre-filled and no password.
  4. Use Add/Remove Programs to uninstall pcANYWHERE.
  5. To be sure you’ve gotten rid of it, go into System Restore (Start > Applications > Accessories > System Tools > System Restore) and roll your system configuration back to the most recent System Restore point.

That should do it.

TIP: If you can’t get F8 to work, make sure you’re using a PS/2 keyboard, not a USB one.

(If your BIOS doesn’t have working USB→PS/2 keyboard emulation, the Windows boot menu won’t see your input either because it happens before Windows’s own USB HID drivers get loaded. This confused me for a moment, before I realized I’d never needed to go into the BIOS setup or boot menu, or access the Windows boot options, since I switched to a USB+VGA KVM switch to let it share the desk with my Power Mac G4.)

Posted in Retrocomputing | Leave a comment

Fanfiction – That Sounds Like Work

How does a completed Worm crackfic based around Taylor Hebert triggering with superpowered laziness sound?

What about a fic with bits like this?

“You let my brother hijack your body… so you don’t have to walk?” said Cherie with an incredulous tone.

“Of course! Have you tried walking? You have to pick up your leg off the ground and everything! The worst bit is that you have to do that over and over again if you want to get anywhere. The mere fact that walking exists proves that there is no such thing as an all-loving God! Man invented the wheel thousands of years ago just so we wouldn’t have to do the devil’s work anymore!” she ranted. This girl was a nut bag. Where did Jean-Paul even find her?

If it sounds good, it’s That Sounds Like Work by Flabbyknight.

…spoiler alert: It starts with her beating Emma by being too super-apathetic (i.e. too lazy to care), driving Emma into such fits of frustration that the Winslow staff can’t help but respond.

In the spirit of the story’s premise, I won’t go on in more detail as I usually would (though I will say that the first chapter, as entertaining as it is, isn’t representative of the heights of crackfic-ness that it grows into) and I won’t take the time to figure out where above 4.5 it belongs on my rating scale.

…but I will say that I loved it and It also won second place in the Crack/Humor category in /r/WormFanfic’s Best of 2019 list.

Posted in Fanfiction | Leave a comment

Quick tip for RetroArch’s DOSBox-Pure core

If you’re trying to set up DOS games like Jetpack in something like RetroPie or Batocera, you might run into a problem where pressing the S key (“start new game” in Jetpack) doesn’t do anything, whether through a physical keyboard or through padtokey mappings.

This is most likely because RetroArch’s default hotkeys map S to one of the buttons on the virtual gamepad. (A decision which makes sense for consoles, where you need a gamepad and a keyboard is optional at best, but makes no sense for retro computers, where a keyboard is standard or even built-in, and a joystick is optional)

While I don’t know about RetroPie, under Batocera, the simplest solution is to add the following lines to your /userdata/system/batocera.conf to disable those mappings:

dos.retroarch.input_player1_a=nul
dos.retroarch.input_player1_b=nul
dos.retroarch.input_player1_x=nul
dos.retroarch.input_player1_y=nul

Then, if you do need mappings for DOS games, they probably go the other way (making the gamepad fake keypresses) and can be handled via padtokey mappings.

Posted in Retrocomputing | Leave a comment

Fixing Applications Which Resist Feeling Platform-Native

NOTE: I will update this post as I run into more application frameworks which need a little encouragement to feel native on my KDE desktop. While a lot of the technologies covered are strongly associated with Linux, they do still tend to be portable, so this information isn’t exclusively for Linux.

It seems like, these days, the rise of Electron and other web-based application toolkits has emboldened every two-bit UI designer to forget that the point of a user interface is to fade into the background and let the content gain full focus. (And that means consistency is paramount.)

I won’t go into detail on that, given that others have already done that:

It doesn’t help that everyone (including Apple) seems to have forgotten Joel Spolsky’s Things You Should Never Do, Part I and that the computing world in general has been sliding in this direction since 2002.

…but it is still my computer, and I still have to live with it… so here’s a reference for how to apply UI customizations to various applications and UI toolkits as an end-user.

Firefox

Call me crazy, but I have to wonder what’s going on at Mozilla headquarters that nobody seems to have asked “Is it possible that making our UI chrome feel less similar to platform-native UI than Google Chrome’s, and grabbing user attention with whizbang elements of dubious value… is hurting our user appeal, not helping it?”

Anyway, here’s a summary of the relevant guides on /r/FirefoxCSS (See also userChrome.org):

  1. Enable userChrome.css:
    • Open up about:config and set toolkit.legacyUserProfileCustomizations.stylesheets to true
    • Create chrome/userChrome.css inside your profile folder (There’s a button to open a file browser window for your profile inside about:support but I somehow broke it while locking down my Flatpak install of Firefox further.)
  2. Enable the browser inspector:
    • Open the developer tools (Ctrl + Shift + I on Linux or Windows), open Settings (the cog which may be inside the overflow/… menu), and enable “Enable browser chrome and add-on debugging toolboxes” and “Enable remote debugging”.
    • Restart Firefox
  3. Write your CSS tweak:
    • Press Ctrl + Alt + Shift + I and choose OK in the “Incoming Connection” dialog (It will probably have appeared behind the unnamed, empty window which will become the browser inspector)
    • You will now have something that looks like the browser’s developer tools but lets you inspect and manipulate the browser’s UI instead. It’ll initially be an ugly vertical split with a log on the left but that will eventually go away. (I don’t know how to make it go away faster)
    • Use the “Inspector” tab to identify what to change
    • To actually make changes, select “Style Editor” and use the “Filter style sheets” field to find userChrome.css. This way, if you like the changes, all it takes to persist them is to click “Save” in the userChrome.css entry in the vertical tabs down the left side.

Here are a few examples of tweaks you can create:

/* Remove pointless thumbnail in the Bookmark popup
   (Why?! You can always see the full version while bookmarking anyway.) */
#editBookmarkPanelImage,
#editBookmarkPanelFaviconContainer {
  display: none !important;
}

/* Hide "Saved to Library!" bookmark confirmation popup
   (The star in the address bar having stayed filled already says that.) */
#confirmation-hint {
  display: none !important;
}

/* Compact sidebar header to match my compact toolbars
 * BUG: https://bugzilla.mozilla.org/show_bug.cgi?id=1435184 */
#sidebar-header {
  height: 32px !important;
  padding: 0 !important;
  font-size: 12px !important;
}

Thunderbird

All the same steps as with Firefox apply (including the caution that the “Incoming Connection” dialog will probably fail to put itself at the top of the window stack), but the means to enable things are in slightly different places. (Thanks to this Superuser Q&A and this /r/Thunderbird thread for helping me piece things together)

  • To access about:config so you can enable toolkit.legacyUserProfileCustomizations.stylesheets, go into the “General” page of settings, scroll down to the bottom, and click the “Config Editor…” button.
  • Instead of typing about:support into the address bar, you can find the button to open your user profile to add chrome/userChrome.css under Help > More Troubleshooting Information.
  • The option to open the developer tools is at Tools > Developer Tools > Developer Toolbox

An example customization you can create would be this:

/* Override the horrendous UI font that Thunderbird suddenly started choosing
   (i.e. Match Qt, GTK+ 2.x, and GTK 3 apps)  */
* {
   font-family: "Noto Sans", "Nimbus Sans L", "Droid Sans", sans-serif !important;
}

NOTE: As of at least Thunderbird version 115, you’ll want to remove the @namespace line from any suggested userChrome.css content or you’ll be fighting an uphill battle to apply changes to the increasing number of elements of Thunderbird’s UI that are HTML instead of XUL.

GTK 3+

Starting with GTK 3, the GNOME people and I have… differences of opinion… made worse by how the links I started with find more fodder in GTK 3 than any other system. While I’ve managed to replace most GTK applications on my desktop with Qt equivalents by now, there still exist a few of them (eg. Inkscape) with no viable replacements.

While such apps are, thankfully, not trying to embrace GNOME-isms that run counter to hard-won design principles from HCI research, they’re still being dragged along for the ride by the GNOME-isms creeping into GTK components outside libadwaita.

  • Archlinux Users: If your intent is to make your GTK 3 stuff feel more native on a non-GNOME desktop, start by installing the gtk3-classic package from AUR. It contains a GTK 3.x patched to revert some of the hard-coded GNOME-isms.
  • Other Distros: If your goals include disabling some visual inconsistency caused by GNOME applying client-side window decorations (eg. drop shadows on context menus), gtk3-nocsd will resolve that… but it is an LD_PRELOAD hack, and getting it to work reliably when Flatpak isn’t designed to allow LD_PRELOAD hacks is iffy, so I’d suggest using it as a last resort.

Settings

No matter how much user-hostility we may feel is present in the GNOME developers’ behaviour these days, they do still allow some customization, so always check that before getting hacky.

For GTK 3, settings are customized by putting lines like gtk-dialogs-use-header=0 into ~/.config/gtk-3.0/settings.ini. For GTK 4, it’s ~/.config/gtk-4.0/settings.ini.

Valid settings.ini keys are documented as properties under the relevant GTK version’s GtkSettings API documentation. (eg GtkSettings for GTK 3)

Here are some suggested changes mentioned on Archwiki:

  • gtk-can-change-accels = 1 is a deprecated GTK 3 option that lets you hover your mouse over a menu item and then press a hotkey to assign to it.
  • gtk-toolbar-style=GTK_TOOLBAR_ICONS is another deprecated GTK 3 option that will give you icon-only toolbar buttons without needing to reach for the CSS overrides (That’s what tooltips are for, don’t you think?)
  • gtk-overlay-scrolling = false is listed as API-unstable, but should replace those touchscreen-style overlay scrollbars with ones where you don’t need to wiggle the mouse to see what your current scroll position is.

There’s also the gsettings set org.gtk.Settings.FileChooser startup-mode cwd command (which you may need to run inside your Flatpaks) to restore the “old-fashioned” behaviour of having GTK file chooser dialogs start in the current directory rather than the recent files list.

Themes

Flatpak should automatically install the Flatpak version of whatever GTK theme you’re using but, if it doesn’t the first two things to try are:

  • Make sure whatever settings daemon your desktop uses is installed and running. If the active theme isn’t being announced, then flatpak upgrade can’t install it.
  • It’s possible your theme hasn’t been packaged for Flatpak. The Stylepak tool will grab whatever GTK theme is active on the host and construct a Flatpak package from it.
  • There’s currently a bug that can cause Flatpak’d GTK applications to revert from Breeze to Adwaita on KDE desktops. To work around it, just go into the Application Style system settings module, click the Configure GNOME/GTK Application Style... button, fiddle around with one of the drop-downs to enable the Apply button, put the themes back to what you want, and click Apply. (I haven’t yet investigated a permanent fix.)
  • According to this thread, there are situations where a customized Breeze color scheme (I just use the default) won’t get applied to GTK 3 apps, and the workaround is a global filesystem override (either via Flatseal or manually editing ~/.local/share/flatpak/overrides/global) to grant access to filesystems=~/.local/share/icons:ro;~/.themes:ro;~/.icons:ro;xdg-config/gtk-3.0:ro;
  • libadwaita-based apps aren’t meant to be themed beyond the light/dark switch and the recolouring API they eventually want to add, but, if the theme was designed to support it, you can force the issue by setting the GTK_THEME environment variable. I recommend doing it on a per-application basis rather than globally.

Open/Save Dialogs

This is one area where things are actually getting better for desktop consistency and user customization instead of worse. If your goal is to get all apps using the same desktop-provided Open/Save dialogs, the GNOME people are on board with that. Thanks to the XDG Portal system, anything that uses GtkFileChooserNative (GTK 3) or GtkFileDialog (GTK 4) instead of GtkFileChooser (holdover from GTK+ 2) is capable of delegating to a common dialog service provided by your desktop.

  • Where possible, install applications through Flatpak or Snap. You’ll get the maximum amount of XDG Portal support by default, you won’t have to upgrade your whole distro to get access to new versions which add more portal support, and any testing the package maintainer does will be done with them enabled.
  • Anything using GtkFileDialog will use portals by default where available.
  • GtkFileChooserNative only uses portals when running under Flatpak/Snap by default, because of buggy behaviour in certain GNOME apps. However, if you’re not using those GNOME apps, you can set an environment variable named GDK_DEBUG=portals (formerly GTK_USE_PORTAL=1) to forcibly enable them.
  • Firefox/Thunderbird: If not using the official Flatpak or Snap packages, open up about:config and set widget.use-xdg-desktop-portal.file-picker to 1

Widgets and/or libadwaita

While I still think the need for it in this situation is a giant regression, I have to applaud the GTK developers for once again demonstrating that, regardless of my disagreements with them on what constitutes good UI design goals, their underlying infrastructure since the beginning of the GTK 3 era (GIR, gtk-rs, etc.) has been admirable.

As of GTK 3.14, they now have an equivalent to the Firefox Browser Toolbox that I pointed you at further up. It’s called GtkInspector, and it’s now a standard part of all GTK installs that just needs to be enabled through one of these means:

  • Run gsettings set org.gtk.Settings.Debug enable-inspector-keybinding true. Any GTK application started after you did that will open GtkInspector when you press Ctrl+Shift+D.

    (If it’s a Flatpak, you may need to use flatpak run --command='sh' <AppID> or flatpak enter <AppID> and run the gsettings command inside the Flatpak.)
  • Run the application with the GTK_DEBUG=interactive environment variable set. The inspector will open automatically.

Here are some tips:

  • GTK extends CSS with a @define-color name #c01040; construct, and those defined colours are referenced by using @name where you might otherwise use something like #f0f0f0 or white.
  • If your Flatpak app isn’t obeying the colours you expect and the widgets used by the application are very similar in Adwaita and your chosen theme, check the Visual tab in the inspector to see if it’s just falling back to Adwaita. See my previous comment about an open KDE bug for a workaround for that.
  • Look at the class name (eg. GtkPaned) in the Object tab’s header (to the right of the drop-down button) and search for it in the online GTK API documentation for whichever version of GTK you’re dealing with. Each entry has a “CSS nodes” section (intended to allow application developers to customize their UI) which will help you craft your overrides. (eg. GtkPaned under GTK 4)
  • Don’t get demoralized if your changes don’t seem to be doing anything. It is more finicky than tweaking Firefox’s UI using the Browser Toolbox.

To make changes to GTK 3 apps global and persistent, put the CSS you figure out into ~/config/.gtk-3.0/gtk.css. Here’s a fix I’m currently using:

/* Workaround for [Breeze] [Bug 414763] */
scrollbar trough { min-width: 6px; }
scrollbar:hover trough { min-width: 6px; }
scrollbar.horizontal trough { min-height: 6px; }
scrollbar.horizontal:hover.horizontal trough { min-height: 6px; }
scrollbar slider { min-width: 6px; }
scrollbar slider:hover { min-width: 6px; }
scrollbar.horizontal slider { min-height: 6px; }
scrollbar.horizontal slider { min-height: 6px; }

Fonts

As of GTK 4, lots of people without HiDPI displays have been complaining about blurry text. (i.e. the forcing of the “accurate glyph positioning is more important than crisp glyph edges” approach to low-resolution font rendering that Apple has been using since they stopped using bitmap fonts, long before high-DPI displays as opposed to the approach Microsoft has historically taken of using “font hinting” to find the least bad way to nudge lines to line up with pixel boundaries.)

None of the remaining GTK apps on my desktop have upgraded off GTK 3 yet (in fact, the Geeqie Flatpak finally considered their GTK 3 port debugged enough to migrate off GTK+ 2.x today) but I’ve read that making sure you’re on GTK 4.6 or newer and adding gtk-hint-font-metrics=1 to ~/.config/gtk-4.0/settings.ini will help.

Ttk (Themed Tk)

Here’s a list of Ttk themes you can browse through to find something as close as possible to the rest of your desktop.

If their Installation guide isn’t enough, I wrote about how to to it more manually years ago.

Wine

Last time I tried using Wine’s .msstyle support (many years ago), it made the UI sluggish to respond, so I just found a .reg patch to apply the default Breeze colour scheme to regular Windows 9x-style Win32 widgets instead.

From what I remember, applications have to opt into themed widgets on Windows, while basic colour schemes go back at least as far as Windows 3.1, so you’d probably benefit from one of these even if you do enable a .msstyle theme… though the comments on the Breeze Dark colour scheme do point out that Wine 7.4 gained an on-by-default msstyle named “Light” that you may need to switch back to “(No style)” in winecfg.

Here’s what I used, plus a dark variant of it:

Web Apps

Tons of people have written about restyling things with CSS userstyles, so I’ll just give a few tips:

  • You can access Firefox’s normal context menu with Shift+RightClick if it’s been overridden.
  • You can access things like Page Info without knowing their keyboard shortcuts by tapping Alt to reveal the traditional menu bar.
  • I recommend Stylus as a userstyle host for Firefox and Ungoogled Chromium.
  • Here’s an example where I worked around Discord’s lack of easy-to-match CSS classes to turn off the distracting visual cacophony of customized username colours:
/* I don't want my chat client to look like a Hawaiian shirt, thanks. */
span[class^=roleColor-], span[class*=' roleColor-'] {
    color: #72767d !important;
}
span[class^=username-], span[class*=' username-'] {
    color: #23262a !important;
}

For the record, the ability to do this is one of the reasons I prefer in-browser versions of unavoidable web-tech to Electron versions. (The other major reason is that they’ll accept tighter sandboxing.)

Posted in Geek Stuff | Leave a comment

Learning Materials for getting into Windows 3.1 programming

As with my other recent post (Learning Materials for getting into C programming for MS-DOS/PC-DOS/DR-DOS/FreeDOS), I’m also gearing up to do the Windows 3.1 hobby programming I wanted to do as a kid but couldn’t, and that means collecting learning resources for that too.

NOTE: I haven’t managed to research the intermediate and advanced materials as thoroughly as for DOS yet, so suggestions are welcome.

C Programming itself
As with DOS programming, I don’t want to recommend the books I just happened to use. Any book should do.
Segmented memory models in C, linked lists, hash tables, and the trade-offs therein
Win16 adds more to memory management on top of what’s available in DOS, but it’s fundamentally still just real-mode C or C++ programming, so start by learning the same things.
Borrow Microsoft C: Secrets, Shortcuts, and Solutions by Kris Jamsa from the Internet Archive’s book library and read chapters 25 (Dynamic Memory Allocation) and 28 (Understanding Memory Models) and borrow Advanced Turbo C by Herbert Schildt and read Chapter 3 (Dynamic Allocation).
See also the Special Pointer Types for Open Watcom C/16 section of the Open Watcom 2.0 C Language Reference once you’ve had things start to click.
Windows 3.1 Application Quick Start
Read Building Win16 GUI Applications in C by Transmission Zero. It’s a quick online article/post that goes through how to produce the working skeleton of a Windows 3.1 application using a 16-bit Microsoft C Compiler but explicitly points out Open Watcom C/C++ as one of example of the any other compilers with the “necessary headers and libraries for Win16 development” that should work too.
Beginner Windows 3.1 Programming
Programming Windows 3.1 by Charles Petzold is apparently considered the gold standard for an introduction to Windows 3.1 programming. Thankfully, it’s available in the Internet Archive’s lending library and, thankfully, Mr. Petzold still offers a download of the companion floppy on the old version of his website.
In the event that you can’t use that for some reason, another one which the Watcom manuals suggest, which isn’t in the Internet Archive’s collection is Windows Programming Primer Plus by Jim Conger from Waite Group Press. It’s not in the Internet Archive’s collection as far as I can tell, so you’d have to turn to WorldCat or AbeBooks for that one.
Windows 3.1 API Reference
If you’re using Open Watcom C/C++, then you won’t have the advantage of Microsoft’s Windows API documentation.
Their manuals recommend buying the Windows API Bible (Windows 3.0 APIs) and the Windows API New Testament (Windows 3.1 API additions) by James L. Conger from Waite Group Press… both of which are also in the Internet Archive’s lending library.
Intermediate Skills
This is where things get hazy. Historically, people tended to learn about this sort of thing through journals like Dr. Dobb’s Journal, The Windows Programmer’s Journal, and so on. There are also some journal issues included on the MSDN Library Archive CD that you could get as an option from Microsoft back in the Windows 9x era and install using the CD key from the corresponding release of the regular MSDN library disc. However, those don’t turn up very often on eBay.
That said, for a less involved way to start moving beyond beginner materials, my searches turned up a book named The Windows Programming Puzzle Book by Kim Crouse… and, yes, that is another link to the Internet Archive’s lending library. To put it simply, the first third of it is a set of questions, programming challenges, and buggy programs to be fixed, and the latter two thirds are answers, including explanations for why they’re the answer.
As for DDE references, I ran across a piece of advice in Dino Esposito’s Visual C++ Windows Shell Programming which recommends the documentation included with the Microsoft Internet Client SDKs as the best place for information on DDE… which I believe are the files archived here.
Advanced Stuff
Funny enough, the advanced stuff was easier for me to find, because there are good resources in the same series as Undocumented DOS and The Undocumented PC, which I already had. Specifically, Undocumented Windows by Andrew Schulman, David Maxey, and Matt Pietrek and Windows Internals by Matt Pietrek, both available in the Internet Archive’s lending library.

See Also: Useful Info On Win16-Targeting Compilers… And a List of DOS/Win16 Resources

A Note on Convenience Over Openness

If you find writing a Windows 3.1 application in C or C++ too daunting and your primary goal is solving your own problems conveniently with no concern for making available open-source code for anyone to contribute to, there are options which are generally much easier than C or C++, but require buying proprietary software.

Suggestion 1: Borland Delphi 1.x

My first recommendation would be to search eBay for a copy of Borland Delphi 1.x on CD (either on its own or included on the CDs for Delphi 2.x through 4.x to support 16-bit development.).

It produces fast, self-contained EXEs and, for the kinds of tasks taught by Petzold in Programming Windows 3.1, it’s stupid simple.

(Having never used it before, I was able to create a “mirror a text field’s contents in a label” application in five minutes, just by dragging a couple of controls into the dialog builder that it opens into, double-clicking the text field to open up the Edit1Change handler, tentatively typing Label1.Text = Edit1.Value into it, pressing F9 (Run) to get an error message telling me my guess was wrong, and then selecting identifiers and pressing F1 or choosing “Topic Search” from the context menu to discover that it should be Label1.Caption := Edit1.Text.)

Seriously. Delphi is a ridiculously polished way to quickly whip up a GUI application, even for 2023, let alone for 1993.

Suggestion 2: Visual Basic 4 or lower

My second choice would be Microsoft Visual Basic 1, 2, 3, or 4.

It’ll be harder to find copies on eBay, they’ll probably cost more, the resulting binaries won’t run as fast, it doesn’t produce self-contained single-file executables, the IDE-Help integration can’t automatically resolve an identifier’s name to the corresponding widget’s documentation, CD-ROM versions of anything older than Visual Basic 4 are practically unobtanium, and Visual Basic 4 splits binaries across many more files than Visual Basic 3… but its ease of use is comparable to Delphi and I was still able to make the same test app in under 5 minutes when I haven’t touched BASIC of any kind in over 20 years.

Visual Basic 3 is generally agreed to be the best version for Windows 3.1 development.

Suggestion 3: WinBatch

If something more like AutoHotKey for Windows 3.1 would meet your needs, go grab a copy of the trial version of WinBatch 4.0L from the Internet Archive and see if it does what you want.

If so, go to the WinBatch website and buy a copy. They explicitly say “Support for Windows XP, Vista, 7, 8, 8.1, 10, 11, 2003, 2008, 2012, 2016, 2019, and 2022. Older versions are available for 95, 98, ME, NT, 2000, and even Windows 3.1”

Posted in Retrocomputing | Leave a comment

Learning Materials for getting into C programming for MS-DOS/PC-DOS/DR-DOS/FreeDOS

For a while now, I’ve been wanting to get into some DOS hobby programming using Open Watcom C/C++ (or maybe gcc-ia16), but, given that DOS programming was on the wane before the Internet came around, and my childhood programming stuff is either for BASIC or a copy of Microsoft C/C++ 7.0 with reference manuals but no tutorials, that was proving kind of difficult.

However, recently, I was clued into the fact that there are actually some pretty good books I could borrow for free on the Internet Archive as a way to either determine that I wanted to buy them, or just read those crucial few pages that would make other resources make sense in the mind of a more modern programmer… so here’s what I’ve found so far:

C Programming itself
Literally any decent learning materials will do, so I don’t want to recommend the books I just happened to use.
Segmented memory models in C, linked lists, hash tables, and the trade-offs therein
Borrow Microsoft C: Secrets, Shortcuts, and Solutions by Kris Jamsa from the Internet Archive’s book library and read chapters 25 (Dynamic Memory Allocation) and 28 (Understanding Memory Models) and borrow Advanced Turbo C by Herbert Schildt and read Chapter 3 (Dynamic Allocation).
See also the Special Pointer Types for Open Watcom C/16 section of the Open Watcom 2.0 C Language Reference once you’ve had things start to click.
Using VGA’s 640x480x16color Planar Graphics Mode
Borrow The Waite Group’s Microsoft C programming For The PC, Second Edition by Robert Lafore from the Internet Archive’s book library and read chapter 11 (Direct-Access Graphics).
See also chapter 2 (Icon-Based Interfaces) of The Craft of C by Herbert Schildt.
Using 256-color linear graphics modes on VGA and reading the mouse
Read David Brackeen’s 256-Color VGA Programming in C. (It’s a free series of online tutorials with source downloads for DJGPP and “Borland C, Turbo C, etc.”)
Playing music on an Adlib-compatible sound card
Download Programming the AdLib/Sound Blaster v2.0 (A.K.A. adlf.zip) from the Internet Archive. (local copy)
Playing digital audio on a SoundBlaster-compatible sound card
Download SoundBlaster Programming Information v0.90 (local copy), Soundblaster programming routines (C++ src) (utility code under MIT-like license terms) (local copy), and Programming the SoundBlaster 16 DSP (local copy).
Reading from the PC Gameport
Read ePanorama.net – PC analogue joystick interface.
DOS/BIOS interrupt API reference
See Ralf Brown’s Interrupt List (alt, download).
Turbo Vision API documentation
When Borland released the source code for the C++ version of their Turbo Vision TUI library and the Free Pascal people ported it back to Pascal as Free Vision, neither released API documentation.
The recommended Borland Turbo Vision Version 2.0 Programming Guide is in the Internet Archive’s collection.
Everything else I’ve been interested in about DOS programming so far
Start by borrowing The Craft of C by Herbert Schildt and The C Toolbox, Second Edition by William James Hunt from the Internet Archive’s library. (Among other things, the former covers TSRs in C, writing a rudimentary C interpreter, basic EGA graphics, interacting with the DOS mouse drivers, implementing a screen editor, and building an icon-based interface and icon and bitmap font editors while the latter covers other useful things like TUI popup windows and using the serial port.)
If you want another book that I found useful, Find a brick-and-mortar library with or buy a used copy of “The Art of C: Elegant Programming Solutions” by Herbert Schildt. (There’s a fair bit of overlap with the prior two, but also some useful non-overlap. Its chapters cover TUI pop-up and pull-down menus and pop-up windows, writing TSRs in C, Mode 4 (CGA) graphics including 2D rotation, basic DOS game development, using the serial port, writing a rudimentary BASIC interpreter, miscellaneous text-mode stuff like using color and changing the text cursor size, controlling the PC speaker, interacting with DOS mouse drivers, and drawing bar graphs.

Beyond that, you’re into more advanced stuff like Michael Abrash’s Graphics Programming Black Book (HTML, Markdown sources for making ePub/Mobi files), Undocumented DOS, or the references for things like VESA and software 3D scattered around places like the Wayback Machine archive of STEEL’s Programming Resources.

I hope this helps you and you may also want to check out my Useful Info On Win16-Targeting Compilers… And a List of DOS/Win16 Resources post and my similar list of learning materials for Windows 3.1.

Posted in Retrocomputing | Leave a comment

How to Hack gtk3-nocsd Into Flatpak Applications

WARNING: Use at your own risk. This is NOT a supported configuration and you’ll want to turn this off and re-test before reporting any bugs. (i.e. Report bugs gtk3-nocsd fixes, not ones it causes.)

OK, so you’ve got a desktop that’s using gtk3-nocsd and a GTK app that renders fine outside Flatpak, but does something unacceptably CSD-ish inside Flatpak. (For me, among other things, it’s non-GNOME GTK-using applications like Deluge displaying big black borders on things like context menus when KWin’s compositing is disabled.)

TIP: If it’s only the shadows on the context menus you don’t like, then it’s easier and more reliable to toss decoration, decoration:backdrop { box-shadow: none; } into your ~/.config/gtk-3.0/gtk.css.

The Flatpak developers don’t appear to see this as an issue, and not all applications have a good Qt-based counterpart, so what’s a stubborn “It’s my ****ing computer” person supposed to do?

…what about taking advantage of how Flatpak applications were already probably printing this to the terminal every time you launched them?

ERROR: ld.so: object 'libgtk3-nocsd.so.0' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.

Here’s how you shoe-horn your gtk3-nocsd into Flatpak without rebuilding the Flatpak Runtime or the application package:

  1. Create a folder that Flatpak isn’t going to overlay, like /gtk3-nocsd and make sure it’s got the same 0755 root:root permissions as anything else nobody but root should be able to muck in.
  2. sudo cp -p /usr/lib/x86_64-linux-gnu/libgtk3-nocsd.so.0 /gtk3-nocsd (substitute whatever path your host distro uses for the original, non-symlinked library file and note the -p to preserve the permissions and ownership. You need the sticky bit to pass certain safety checks.)
  3. Go into Flatseal or use flatpak override and grant your application filesystem access to /gtk3-nocsd:ro, then add an environment variable override to LD_PRELOAD=/gtk3-nocsd/libgtk3-nocsd.so.0

Congratulations. For better or for worse, you should now have your Flatpak’d application loading gtk3-nocsd like an un-Flatpak’d application. It seems to have solved the “big black borders on context menus with compositing disabled” issue in Deluge-GTK for me… but I make no guarantees that it’ll work for you.

You can check if it’s getting loaded by:

  1. flatpak enter <app ID> sh
  2. ps ax to get the PID of the process (probably 2 in my experience)
  3. grep nocsd /proc/<PID>/maps

In theory, you could do this in Flatseal’s “All Applications” tab, but why tempt fate. Do as I did. Apply it selectively to just the applications that exhibit problems.

I doubt the Flatpak devs will ever enable ld.so‘s secure execution mode, since it disables LD_LIBRARY_PATH, which is used in some launcher scripts to make some applications find their libraries under /app rather than /usr/lib (I had to use it to get a custom build of SDL_mixer to find libmodplug at runtime even though it found it without issue at compile time) but, if so, the next step would be to try injecting gtk3-nocsd.so.0 into /var/lib/flatpak/runtime/org.freedesktop.Platform/x86_64/<VERSION>/active/files/lib/ so it’ll show up in the list of standard paths ld.so‘s secure mode is whitelisted to.

Posted in Geek Stuff | Leave a comment