Skip to content
  • Categories
  • Recent
  • Tags
  • All Topics
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Caint logo. It's just text.
  1. Home
  2. Uncategorized
  3. Ever since I first added it, the Windows version of Star Wars Chess had a bizarre problem: the pieces at the bottom faced the wrong way, as in the first screenshot
Welcome to Caint!

Issues? Post in Comments & Feedback
You can now view, reply, and favourite posts from the Fediverse. You can click here or click on the on the navigation bar on the left.

Ever since I first added it, the Windows version of Star Wars Chess had a bizarre problem: the pieces at the bottom faced the wrong way, as in the first screenshot

Scheduled Pinned Locked Moved Uncategorized
2 Posts 2 Posters 0 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Aaron GilesA This user is from outside of this forum
    Aaron GilesA This user is from outside of this forum
    Aaron Giles
    wrote last edited by
    #1

    Ever since I first added it, the Windows version of Star Wars Chess had a bizarre problem: the pieces at the bottom faced the wrong way, as in the first screenshot.

    Everything else seemed to work fine except this one annoying issue, and I was never able to figure it out.

    Flash forward to today, when a helpful user on the discord asked if the INI files might be the issue. The game, being from the Windows 3.1 era, uses a ton of INI files to describe various things about the configuration.

    Eventually the user pointed out that if they modified the file CM.INI and changed one of the letters in another emulator, they could get all the pieces to face forward just like in DREAMM.

    This definitely warranted an investigation.

    The entries in question look like this:

    [chesssets]
    WHTBTM_=WhiteOnBottom 3 P S 68 142 2
    WHTTOP_=WhiteOnTop 3 P S 68 142 2
    2DSET_=Setup 2 P S 37 45 1
    FACING_=FrontFacing 3 P S 68 142 2

    To read information from the INI files, the game uses the GetPrivateProfileString API, which is a Swiss army knife for fetching information. With certain parameters, it can be used to query the list of values in a section, and the game would use this to get the list of entries in thechesssets` section.

    What became apparent, after much debugging, was that it presumed the order of the entries matched that in the INI files. Unfortunately, I was using a std::map to store the entries, which meant I lost the original order and instead would return them in alphabetical order.

    So when it defaulted to item index 1, instead of picking the WHTTOP_ item, it ended with the FACING_ item. And the FrontFacing item would show all pieces as front-facing.

    So in a furious bit of rewriting, I ripped out the std::maps and just used std::vector instead, searching for items manually instead of using find() on the map. Slightly slower but this API isn't exactly a high-frequency thing.

    And sure enough, I can finally close the book on a bug that's plagued me for a couple of years now.

    StinkstiefelO 1 Reply Last reply
    1
    0
    • R ActivityRelay shared this topic
    • Aaron GilesA Aaron Giles

      Ever since I first added it, the Windows version of Star Wars Chess had a bizarre problem: the pieces at the bottom faced the wrong way, as in the first screenshot.

      Everything else seemed to work fine except this one annoying issue, and I was never able to figure it out.

      Flash forward to today, when a helpful user on the discord asked if the INI files might be the issue. The game, being from the Windows 3.1 era, uses a ton of INI files to describe various things about the configuration.

      Eventually the user pointed out that if they modified the file CM.INI and changed one of the letters in another emulator, they could get all the pieces to face forward just like in DREAMM.

      This definitely warranted an investigation.

      The entries in question look like this:

      [chesssets]
      WHTBTM_=WhiteOnBottom 3 P S 68 142 2
      WHTTOP_=WhiteOnTop 3 P S 68 142 2
      2DSET_=Setup 2 P S 37 45 1
      FACING_=FrontFacing 3 P S 68 142 2

      To read information from the INI files, the game uses the GetPrivateProfileString API, which is a Swiss army knife for fetching information. With certain parameters, it can be used to query the list of values in a section, and the game would use this to get the list of entries in thechesssets` section.

      What became apparent, after much debugging, was that it presumed the order of the entries matched that in the INI files. Unfortunately, I was using a std::map to store the entries, which meant I lost the original order and instead would return them in alphabetical order.

      So when it defaulted to item index 1, instead of picking the WHTTOP_ item, it ended with the FACING_ item. And the FrontFacing item would show all pieces as front-facing.

      So in a furious bit of rewriting, I ripped out the std::maps and just used std::vector instead, searching for items manually instead of using find() on the map. Slightly slower but this API isn't exactly a high-frequency thing.

      And sure enough, I can finally close the book on a bug that's plagued me for a couple of years now.

      StinkstiefelO This user is from outside of this forum
      StinkstiefelO This user is from outside of this forum
      Stinkstiefel
      wrote last edited by
      #2

      @aaronsgiles Found another bug: Storm Troopers should always miss their target. 😭

      1 Reply Last reply
      1
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • All Topics
      • Popular
      • World
      • Users
      • Groups