Cursor Lock FAQ and Future

Q. Cursor Lock doesn’t work for X program.

I understand that the underlying concepts involved in getting Cursor Lock to function correctly in Program Mode possibly exceed the capabilities of some users, e.g. casual teenage gamer.  So, if your eyes are glazing over at the prospect of having to figure out what is meant by a “Lock Program” and an “Open Program”, just skip Program Mode altogether and bask in the simplicity of User Mode.  In User Mode, Cursor Lock runs in the background and you control it with hotkeys.  There’s even a handy shortcut to User Mode in your Start Menu. Just don’t forget your hotkeys. 😉

However, if you’re more of the advanced sort, you’ll appreciate that Program Mode only runs when you need it and thus doesn’t waste resources.  Most people get hung up on the difference between the “Open Program” and the “Lock Program”, thus it is useful (and perhaps necessary) to understand the general execution flow, which is as follows.

Cursor Lock FlowchartBy separating the program that is executed from the one that is cursor-locked, it allows for launcher programs to be supported. Many programs (games) use launchers, which are executables that are separate from but are required to execute before the main program executable.  Steam can be considered a launcher.

Now if you’re grasping the operation of Program Mode but are still having problems, here’s what to do.

  1. You’ve got to select the appropriate executables for the Open/Lock Program fields, which can be tricky to figure out. Use Task Manager to help you see what processes go to what windows.
  2. If you’re having trouble finding the right launcher executable, you might try the forever-useful Procmon and setting it to monitor “Process and Thread Activity” before running the program in question.
  3. Next, try enabling the log file from Cursor Lock’s options.  Run a Cursor Lock shortcut or a “Test” and then read the log to help determine what happened.  You might find that Cursor Lock either closed before your desired program was locked or never locked at all, both of which suggest that the wrong executables were selected.
  4. Still not achieving a satisfactory cursor lock? Or something else weird happening?  At this point, I’d be glad to try to help you.  Leave a comment or send an email.

Q. The hotkeys won’t work.

This issue seems to be cropping up more and more, and I don’t really have a satisfactory answer as for why yet.  It also seems as though some programs will override all system hotkeys altogether, annoyingly enough.  The best advice I can give is as follows.

  1. Make sure Cursor Lock is actually running.  You should see cursorlock.exe in Task Manager.
  2. Try changing your hotkey combination to something else.  There may be conflicts with the current combination or perhaps it didn’t save correctly.
  3. If you’ve modified the hotkey combination used to toggle locking, make sure that change was saved to the configuration file, cursorlock.ini. If not, you may need to run Cursor Lock Setup with elevated permissions, i.e. Admin Mode, or try using the default hotkey combination of Ctrl-Alt-L instead.

Q. I can’t uninstall it.

That’s quite true.  There is no uninstall feature at present.  Although, there really isn’t much installed to be begin with, so I hope you’ll forgive my omission.  I do see the error in not including an uninstaller and will rectify this in future versions.  In the meantime, here’s how to uninstall Cursor Lock.

  1. Delete the directory that you installed Cursor Lock to.
  2. Delete the Start Menu folder for Cursor Lock (if enabled on installation).

Cursor Lock 3.0?

I’m frequently amazed that Cursor Lock is still relevant more than ten years after I first wrote it.  Although its focus was originally on correcting a multi-monitor support oversight, many users are now employing Cursor Lock for their windowed gaming needs instead.  This shift in audience from enthusiast gamers to gamers in general has had me thinking about how to further simplify Cursor Lock.

As mentioned in the FAQ above, Program Mode is great for efficiency but a pain for anyone but advanced users to figure out.  Personally, I loathe having yet another program running in the background on the off-chance that I might run a program that needed it.  But memory is cheap these days, so I must reluctantly deprecate Program Mode in favor of User Mode.  But, I’d like to make User Mode even better.  So that all the user would need to do is select the window to lock from a list of all open windows using a systray icon, and that window will always be locked whenever you use it.  I might even add support for the often-requested but niche use case of restricting the cursor to a user-defined area.

However, I would have done this already a year ago if it weren’t for my health being in such a dubious state the last several years.  But, if good health ever returns, believe me that an update to Cursor Lock will be the first thing I do.  In the meantime, I hope the FAQ helps.  Also, I’m sorry if I don’t answer your messages and comments promptly; there are a lot of days where I can’t even put together a cogent and well-thought-out response.  So again: FAQ.  And I’ll help when I can.

Posted in Programming, Software, Troubleshooting | Tagged | Leave a comment

Diablo II Mods and Code Stuff

Hello all. My apologies for not updating this website more.  My life has become complicated lately, and in these uncertain times I find it difficult to want to write about it.  A shame really, as the site has never been more popular.  Seems like every time a new game comes out lacking multi-monitor support, I get hundreds of new visitors and users for Cursor Lock; a few weeks ago, it was Cites: Skylines.  And today with the announcement of another new Deus Ex game, my version of the soundtrack is hotter than ever.  It does make me feel good to know that I can produce things that people need, even if it’s only for video games.

Speaking of video game content, I spent a lot of time a few months ago working on a new class for Diablo II.  Well, it’s not really a completely new class, more like a subclass since I only changed one skill tree for the Amazon.  It just really bugged me how the Amazon felt so lame compared to the Diablo 3 Demon Hunter.  It’s really difficult to keep the monsters from swarming the Amazon, so I designed some Demon Hunter-inspired skills to help remedy the problem, such as caltrops, turrets, and smokescreens.  You can see these skills in action in the video below.

I also just wanted to fulfill my desire to do some really hardcore modding for Diablo II.  The game has a rather awkward system for making modifications.  If it were made today, we’d probably have XML files and LUA scripts to work with.  But since it was made 15 years ago, we instead have to settle for massive CSV files.  You can find the Demon Hunter mod on my Diablo II mod page.  And massive props to the Phrozen Keep for continuing to support D2’s modders.

Another thing that bothered me about Diablo II for so long is that when you die your corpse keeps all your equipment on it, and you respawn basically naked and unarmed.  Your only options are to run in, snatch everything off your corpse, and teleport back to town, or rage quit and hope that your corpse returns to town like it’s supposed to.  Obviously, this is almost always zero fun and is why no games handle death like this anymore.

Unfortunately, there’s no way to change this in the game’s CSV tables.  But I didn’t let that stop me.  Every now and then, a problem comes along which must be solved through assembler hacking, and this was one of those times.  But I didn’t really have a clue which function was involved in character death.  So, I just put breakpoints on every function in IDA and attached to the running process.  It took a while of breaking, disabling breakpoints, and resuming, but I eventually narrowed it down to several dozen functions involved in death.  Some functions did death animations, some saved character data, but then I found a suspicious bit of code that would loop 14 times—the number of equipment slots.  This was the code where the game looped through each equipment slot and moved the item from the player to the player’s dead body.  And then there was nothing left to do but some trial and error to figure out where I could safely jump over the offending code and re-enter.  Now the only problem is that this mod will have to be updated every time there’s a Diablo II patch. 😥

Here we see the fateful jump operation to bypass the character equipment being removed.

Here we see the fateful jump operation to bypass the character equipment being removed.

Since then, I’ve been turning back to more PHP/HTML/CSS/JS coding.  I’m working on a project that I can’t disclose at this time but which quite possibly could be my most epic work yet.  Wish me luck in completing it.

Recently, I’ve also been using PHP as my go to scripting language for everyday projects.  A couple days ago, I wanted to be able to pull all GPS image data from a directory and display it in Google Earth.  PHP has file IO, EXIF, and XML libraries, so it was real convenient to bash out a script using that.  Then I realized I had created an account on Github recently to comment on some projects and thought why not just put this code on there.  So I did.  Maybe I’ll add more small projects like this in the future.

Posted in Modding, Programming, Website | Tagged , , , , , | 2 Comments

Rise of Nations Script Maker 2.0 Preview

Rise of Nations Script Maker 2.0

Rise of Nations Script Maker 2.0

I’ve been working on a new version of my Script Maker for Rise of Nations since the release of the Extended Edition a few months ago.  I naively thought it just was going to be a matter of converting the code to .Net and updating a few routines to support EE.  However, once I saw the state of the code, I decided it was going to have to be completely rewritten.  After all, it was ten year old code written in VB6.  And I was really appalled by the “hackiness” of so much of the code—mostly because VB6 had so few built-in functions and relied on the Windows API so much.

So since I was rewriting the whole program anyways, I took the opportunity to make numerous improvements.  I won’t post the whole changelog, but here are some of the highlights:

  • Streamlined the interface significantly
  • Stat tables now support filtering, sorting, and better change highlighting
  • Broke the stat tables up by units, buildings, and techs while combining disabling and researching with stats
  • Scripts can now have descriptions
  • All data is loaded from the games now
  • Changed the script save format to XML
  • Dropped the use of the MSXML library in favor of .Net’s XML library

At this point, I’m mainly just doing testing and documentation. So, expect release within the next couple of weeks.  I may put a call out for beta testers before then, but I haven’t decided yet.

Posted in Gaming, Modding | Tagged , | Leave a comment

Brecourt Video Update

I’ve still been putting a lot of work into my Brecourt Manor map lately, and it feels like it’s over half complete.  I’ve got a lot of the hedgerows placed, so it’s mostly a matter now of filling in the fields and making everything look natural.  The map’s script has also come a long way (at over 700 lines so far) but still has a lot of tweaking left to go.  However, I’m feeling a lot more comfortable with LUA and the SCAR functions, so it should go quickly.

A couple weeks ago, I dabbled briefly with the Unity engine to see if it was viable for another project I’ve been longing to make.  There’s a lot to learn up-front about Unity before you can get anything even playable (take Quaternions for example), but then things start to come together.  In only a few days, I made from scratch a basic tank that drives around and shoots with (mostly) realistic physics.  I must say, though, that this is the most math I’ve done since college.  😕

Posted in Gaming, Modding | Tagged , , , | 1 Comment

Brecourt Manor Progress

Brecourt Manor 11-17-13The gun trenches are more or less complete and work has started on the surrounding environs.  Creating realistic-looking hedgerows is a multi-step process: trees first, then the hedges themselves, bushes, and finally some scrub grass to smooth out the base.  Then repeat over and over because Normandy is nothing but hedgerows.

Posted in Gaming, Modding | Tagged , | Leave a comment

Brecourt Manor in CoH

A few months ago, I released my first singleplayer map for Company of Heroes.  I had a lot of fun scripting the scenario, which is done entirely in LUA, so I was eager for another map to work on.  And it didn’t take long until inspiration hit me in the form of re-watching Band of Brothers.  The prominent engagement in the second episode is the assault on the guns at Brecourt Manor.  The episode must have inspired others as well, since several video game recreations already exist; most notably in the first Call of Duty.

However, all the existing Brecourt Manor assault recreations have major accuracy flaws.  The CoD one has fairly accurate trenches (where the guns were located), but the context is very flawed (e.g. Easy Company did not subsequently attack the manor itself).  There is also another Brecourt map made for CoH, but being that it was made for multiplayer, balance concerns forced them to change almost all the geography other than the trenches.

So to distinguish my attempt from all the others, I decided to make what I hope is the most accurate portrayal of the battle.  To achieve this, I first gathered up as many maps as I could showing the fields and hedgerows where the battle occurred—present day Google maps, 1947 aerial map, D-Day recon map, and a map apparently provided by Maj. Winters.  I then layered and lined up the maps in an image editor to create a composite image of the most accurate map I could make.  That image appears below.

Brecourt Manor Assault Template Map

Brecourt Manor Assault Template Map

You can see on the above image that I’ve already established the playable area (red rectangle) and the map boundaries (green rectangle) for the CoH map, with the gun trenches located in the center.  But the next step is where the real magic happens in making this map as accurate as possible.  In a process I first used in my Ogledow map, I took a greyscale version of the composite image above, saved it to a bitmap, and then copied its raw bytes into a data format called a “stamp”.  The CoH WorldBuilder uses these stamps to let you copy map data between maps, but using this technique, one can also copy data from images into maps.  The result can be seen in the below images.

The result being an extremely accurate template by which to “draw” the actual map content.  This is about as far as I got when I first started working on the map since Serpent 3 was nearing the end of its life at the time.  But I just recently got back into it and I’ve made some pretty good progress, although I’m nowhere near done.  I’d say I’m to a point where it’s playable, though.  (Props to the guys at Relic that actually make these maps from scratch.  It takes forever to get them to look realistic.)

Posted in Gaming, Modding | Tagged , , | Leave a comment