Tag Archives: C++

Very Sleepy fork

I got fed up with waiting/pestering Richard Mitton (aka Kayamon / @grumpygiant) to integrate the Very Sleepy patches I’ve sent him last year or putting the code on a software forge, so I’m publishing my patches on GitHub myself.

Very Sleepy is a polling Windows profiler with a wxWidgets-based GUI. This is a fork of the latest released version at the time of writing (0.82).

There have been a few more forks of Very Sleepy (e.g. here and here), but these are based off older versions. It’s possible that their changes had already been merged into the official version.

Update: I’ve continued development of my fork, at the above-mentioned location. Check the GitHub project for the changelog, downloads, and more information.

64-bit CacheSet

SysInternals CacheSet has a limitation: it is unable to set a cache size larger than 4GB. This is due to the fact that it is a 32-bit application, and the respective API (NtSetSystemInformation) accepts new settings as a 32-bit byte count.

The solution: use the 64-bit API, which uses 64-bit integers. I’ve written a very simple 64-bit CacheSet-alike – just enter the desired cache size (in bytes). You can use the original CacheSet to check the new settings (just don’t hit “Apply”, or your settings might get clobbered).

Source, download.

GraphStudio fork

I have made a few improvements to GraphStudio, the open-source GraphEdit clone:

  • The limit for text entry in certain combo boxes has been removed
  • Basic XML graph saving support has been added (only filters and connections at the moment)
  • Pins are now referred by their indexes in XML rather than by ambiguous names
  • Added command-line /render parameter, which loads a graph, plays it and exits

XML support and /render allow scripted generation and rendering of XML graph files.

Source, download.

Update: Check out GraphStudioNext. Some or all of my patches have been merged into that project, and presumably will be in the next release (the one after 0.5.0.1).

Why is the amount of text I can type in my combo box limited by its width?

Once in a while you’ll stumble upon a combo box which doesn’t allow you to type past the right edge of the control. When normally typing more text would just scroll the contents, you’ll just get back an annoying beep. The amount of text you can enter is actually bound by the on-screen width of the text – thus, you may be able to enter 125 “i” characters, but only 25 “W” characters.

The cause of the problem is that the combo box was not created with the CBS_AUTOHSCROLL style:

CBS_AUTOHSCROLL
Automatically scrolls the text in the edit control to the right when the user types a character at the end of the line. If this style is not set, only text that fits within the rectangular boundary is allowed.

Visual Studio’s resource editor has a different name and description for this property:

Auto
Automatically scrolls text to the left when the user types a character at the end of the line.

The perfect experience / level curve

I was recently tasked to create a required-experience-per-level table for a game – that is, create a table which indicates how many experience points the player must earn to progress to a certain experience level. The requirement to reach the next level must continuously increase (the “double derivate” must be non-negative). Of course, it is easy to come up with a function to satisfy that requirement alone, but what about generating a level curve that’s also aesthetic? I mean, it’s much nicer to look forward to reaching 15000 points than, say, 16384.

So, I wrote a small program to attempt to generate experience ranks with the following properties:

  1. Continuous acceleration
  2. Smoothness (calculated as “roughness”, using the sum of squares of the “triple-derivate”)
  3. Roundness (100 is more round than 150, 150 is more round than 160, 160 is more round than 165 etc.)
  4. Emphasis on the roundness of the last level

The qualifying factor here is smoothness vs. roundness. Continue reading