|
| 1 | +# Testing games with sdl12-compat |
| 2 | + |
| 3 | +sdl12-compat is here to make sure older games not only work well, but work |
| 4 | +_correctly_, and for that, we need an army of testers. |
| 5 | + |
| 6 | +Here's how to test games with sdl12-compat. |
| 7 | + |
| 8 | + |
| 9 | +## The general idea |
| 10 | + |
| 11 | +- Build [SDL2](https://github.com/libsdl-org/SDL) or find a prebuilt binary. |
| 12 | +- Build sdl12-compat (documentation is in README.md) |
| 13 | +- Find a game to test. |
| 14 | +- Make sure a game uses sdl12-compat instead of classic SDL 1.2 |
| 15 | +- See if game works or blows up, report back. |
| 16 | + |
| 17 | + |
| 18 | +## Find a game to test |
| 19 | + |
| 20 | +We are keeping a spreadsheet of known games that still use SDL 1.2 |
| 21 | +[here](https://docs.google.com/spreadsheets/d/1u8Rq3LVQYYgu28sBuxrZ371QolbiZu5z_LjENc4ddZs/edit?usp=sharing). |
| 22 | + |
| 23 | +Find something that hasn't been tested, or hasn't been tested recently, and |
| 24 | +give it a try! Then update the spreadsheet. |
| 25 | + |
| 26 | +Extra credit if you [file bug reports](https://github.com/libsdl-org/sdl12-compat/issues) |
| 27 | +but we're grateful if you just make notes on the spreadsheet, too. |
| 28 | + |
| 29 | + |
| 30 | +## Make sure the game works with real SDL 1.2 first! |
| 31 | + |
| 32 | +You'd be surprised how many games have bitrotted! If it doesn't work with |
| 33 | +real 1.2 anymore, it's not a bug if sdl12-compat doesn't work either. That |
| 34 | +being said, lots of games that stopped working _because_ of SDL 1.2 will |
| 35 | +now work again with sdl12-compat, which is nice, but just make sure you have |
| 36 | +a baseline before you start testing. |
| 37 | + |
| 38 | + |
| 39 | +## Force it to use sdl12-compat instead. |
| 40 | + |
| 41 | +Either overwrite the copy of SDL-1.2 that the game uses with sdl12-compat, |
| 42 | +or (on Linux) export LD_LIBRARY_PATH to point to your copy, so the system will |
| 43 | +favor it when loading libraries. |
| 44 | + |
| 45 | + |
| 46 | +## Am I actually running sdl12-compat? |
| 47 | + |
| 48 | +The easiest way to know is to set some environment variables: |
| 49 | + |
| 50 | +```bash |
| 51 | +export SDL12COMPAT_DEBUG_LOGGING=1 |
| 52 | +``` |
| 53 | + |
| 54 | +If this is set, when loading sdl12-compat, it'll write something like this |
| 55 | +to stderr (on Linux and Mac, at least)... |
| 56 | + |
| 57 | +``` |
| 58 | +INFO: sdl12-compat, built on Sep 2 2022 at 11:27:37, talking to SDL2 2.25.0 |
| 59 | +``` |
| 60 | + |
| 61 | +You can also use this: |
| 62 | + |
| 63 | +```bash |
| 64 | +export SDL_EVENT_LOGGING=1 |
| 65 | +``` |
| 66 | + |
| 67 | +Which will report every event SDL 2 sends to stderr: |
| 68 | + |
| 69 | +``` |
| 70 | +INFO: SDL EVENT: SDL_WINDOWEVENT (timestamp=317 windowid=1 event=SDL_WINDOWEVENT_MOVED data1=1280 data2=674) |
| 71 | +INFO: SDL EVENT: SDL_WINDOWEVENT (timestamp=318 windowid=1 event=SDL_WINDOWEVENT_EXPOSED data1=0 data2=0) |
| 72 | +INFO: SDL EVENT: SDL_WINDOWEVENT (timestamp=318 windowid=1 event=SDL_WINDOWEVENT_ENTER data1=0 data2=0) |
| 73 | +``` |
| 74 | + |
| 75 | +Since this is a new feature in SDL2, it'll only show up because sdl12-compat talks |
| 76 | +to SDL2 and classic SDL 1.2 doesn't. |
| 77 | + |
| 78 | + |
| 79 | +## Steam |
| 80 | + |
| 81 | +If testing a Steam game, you'll want to launch the game outside of the Steam |
| 82 | +Client, so that Steam doesn't overwrite files you replaced and so you can |
| 83 | +easily control environment variables. |
| 84 | + |
| 85 | +On Linux, Steam stores games in ~/.local/share/Steam/steamapps/common, each |
| 86 | +in its own usually-well-named subdirectory. |
| 87 | + |
| 88 | +You'll want to add a file named "steam_appid.txt" to the same directory as |
| 89 | +the binary, which will encourage Steamworks to _not_ terminate the process |
| 90 | +and have the Steam Client relaunch it. This file should just have the appid |
| 91 | +for the game in question, which you can find from the store page. |
| 92 | + |
| 93 | +For example, the store page for Braid is: |
| 94 | + |
| 95 | +https://store.steampowered.com/app/26800/Braid/ |
| 96 | + |
| 97 | +See that `26800`? That's the appid. |
| 98 | + |
| 99 | +```bash |
| 100 | +echo 26800 > steam_appid.txt |
| 101 | +``` |
| 102 | + |
| 103 | +For Linux, you can make sure that, from the command line, the game still |
| 104 | +runs with the Steam Runtime and has the Steam Overlay by launching it with a |
| 105 | +little script: |
| 106 | + |
| 107 | +- [steamapp32](https://raw.githubusercontent.com/icculus/twisty-little-utilities/main/steamapp32) for x86 binaries. |
| 108 | +- [steamapp64](https://raw.githubusercontent.com/icculus/twisty-little-utilities/main/steamapp64) for x86-64 binaries. |
| 109 | + |
| 110 | +(And make sure you have a 32-bit or 64-bit build of sdl12-compat!) |
| 111 | + |
| 112 | +And then make sure you force it to use _your_ sdl12-compat instead of the |
| 113 | +system/Steam Runtime build: |
| 114 | + |
| 115 | +```bash |
| 116 | +export LD_LIBRARY_PATH=/where/i/installed/sdl12-compat |
| 117 | +``` |
| 118 | + |
| 119 | +Putting this all together, you might run [BIT.TRIP Runner2](https://store.steampowered.com/app/218060/)\ |
| 120 | +like this: |
| 121 | + |
| 122 | +```bash |
| 123 | +cd ~/.local/share/Steam/steamapps/common/bittriprunner2 |
| 124 | +export LD_LIBRARY_PATH=/where/i/installed/sdl12-compat |
| 125 | +export SDL12COMPAT_DEBUG_LOGGING=1 |
| 126 | +echo 218060 > steam_appid.txt |
| 127 | +steamapp32 ./runner2 |
| 128 | +``` |
| 129 | + |
| 130 | + |
| 131 | +## Windows |
| 132 | + |
| 133 | +Generally, Windows games just ship with an SDL.dll, and you just need to |
| 134 | +overwrite it with an sdl12-compat build, then run as usual. |
| 135 | + |
| 136 | + |
| 137 | +## macOS, etc. |
| 138 | + |
| 139 | +(write me.) |
| 140 | + |
| 141 | + |
| 142 | +## Questions? |
| 143 | + |
| 144 | +If something isn't clear, make a note [here](https://github.com/libsdl-org/sdl12-compat/issues/new) |
| 145 | +and we'll update this document. |
| 146 | + |
| 147 | +Thanks! |
| 148 | + |
0 commit comments