Author Topic: Touhou Input Display (thinput) - Release v2.1.0  (Read 29769 times)

Drake

  • *
Touhou Input Display (thinput) - Release v2.1.0
« on: December 13, 2013, 03:07:27 AM »


Download: https://mega.nz/#!5sNFHYAT!KFsHGu8ZQnZNiPEvCT_yG4JvlqTxOwb9OdEbrel9kgQ

A tiny tiny clever tool that reads the memory of Touhou games and gives a display of the game's inputs.
Auto-detects the running game based on its executable name.
Because it reads the game's memory, you can display the inputs of replays as well. It also isn't dependent on a specific key mapping or button config, or what input device you use at all. How fancy.

Currently supported games range from th06 to th165.


Instructions:
- Launch Touhou game, run thinput.


Configuration:
[Window]
- KeyUpImg: Path to the image used for the keys not pushed. Relative to the working directory.
- KeyDownImg: Path to the image used for the keys pushed down. Relative to the working directory.
- BGColor: Color value for the background. Just use hex color values (e.g. FFFFFF).

[Buttons]
- key = left, top, width, height
- left and top are x,y coordinates of where to position the key image; width and height specify the key image size (which can be resized). Window expands to fit.
- You can change these positions if you want a different button layout.
- To "remove" a button from view, just put it at some negative coordinates.

[AddressList]
- Each line lists a game's executable name, the address of its input bit vector, and the map of buttons to the corresponding bit flags.
- You can add or remove as many entries as you want, just make sure it works.
- Valid addresses start with 0x followed by 6~8 hex digits.
- The button map is 8 numbers, each one corresponding to a button. In order they represent Shot, Bomb, Slow, Up, Down, Left, Right, Skip.
    The number represents which bit flag in the vector that button activates. Look at the config file for examples.
- Using this config allows us to add new executable names (e.g. th11boss.exe) and to offer forward-compatibility for new games.


Known Bugs:
- None at the moment!



This was originally a small personal project for displaying my keyboard input that turned into something else.
« Last Edit: August 12, 2018, 04:18:43 AM by Drake »

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -

Re: Touhou Input Display (thinput)
« Reply #1 on: December 13, 2013, 03:30:49 AM »
Wow, thanks, Drake! This should help knowing what the hell happened during lucky dodges.

Re: Touhou Input Display (thinput)
« Reply #2 on: December 13, 2013, 08:16:38 AM »
Thanks. Is it supposed to work in full screen or not?

Drake

  • *
Re: Touhou Input Display (thinput)
« Reply #3 on: December 13, 2013, 08:59:55 AM »
Not really, unfortunately. It seems exceedingly difficult and arcane to render other windows on top of fullscreen d3d applications, so I'm not going to bother wasting my time trying.

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -

chum

Re: Touhou Input Display (thinput)
« Reply #4 on: December 13, 2013, 09:02:28 AM »
It doesn't start for me (assuming It's because I'm on XP)


Drake

  • *
Re: Touhou Input Display (thinput)
« Reply #5 on: December 13, 2013, 09:14:00 AM »
Doesn't start as in doesn't even give you an error? Can any other XP users replicate this? EDIT: never mind replicated ok
« Last Edit: December 13, 2013, 09:23:57 AM by Drake »

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -

chum

Re: Touhou Input Display (thinput)
« Reply #6 on: December 13, 2013, 09:18:17 AM »

Drake

  • *
Re: Touhou Input Display (thinput)
« Reply #7 on: December 13, 2013, 09:47:03 AM »
Oooops my bad. I compiled it as an x64 application instead. New link, should work.

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -

chum

Re: Touhou Input Display (thinput)
« Reply #8 on: December 13, 2013, 11:22:21 AM »
Thank you, it works and I love it!

ark

  • みょん
Re: Touhou Input Display (thinput)
« Reply #9 on: December 13, 2013, 11:27:52 AM »
You should make it do a D3D hook thing so it works fullscreen.

Re: Touhou Input Display (thinput)
« Reply #10 on: December 13, 2013, 01:12:07 PM »
I like this.  And the potential applications of it.
You should make it do a D3D hook thing so it works fullscreen.
Too myon and myon.

Kaze_Senshi

  • Ehhhhh...
  • Pale Apple
    • My youtube channel
Re: Touhou Input Display (thinput)
« Reply #11 on: December 14, 2013, 09:55:03 PM »
Wow colored tetrominos, nice job.

You should make it do a D3D hook thing so it works fullscreen.
yeap yeap
My youtube channel with my creations: https://www.youtube.com/user/KazeSenshi2929
( ゆっくりしていってね)>

Drake

  • *
Re: Touhou Input Display (thinput)
« Reply #12 on: December 14, 2013, 11:12:21 PM »
Well you can replace the images and move them around so you really just have 8 of whatever button graphic.

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -

ExPorygon

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
    • Ephemeral Entertainment
Re: Touhou Input Display (thinput)
« Reply #13 on: December 17, 2013, 06:51:50 AM »
Well this seems interesting. Might as well try it out.

Pesco

  • Trickster Rabbit Tewi
  • *
  • Make a yukkuri and take it easy with me
Re: Touhou Input Display (thinput)
« Reply #14 on: December 18, 2013, 08:35:20 PM »
Could it work out a player's APM and possibly identify cheating?

Ghaleon

  • Long twintail-o-holic
Re: Touhou Input Display (thinput)
« Reply #15 on: December 18, 2013, 10:50:30 PM »
I dont mean to sound jerkish or anything but why would someone want this? I mean you know the guy is pushing up if they're flying up? Im clearly missing something. Regardless thanks for continuing to work on these things!

Re: Touhou Input Display (thinput)
« Reply #16 on: December 18, 2013, 11:12:30 PM »
It could also be used to detect frame-perfect play.

I'm guessing PCB uses a different method of handling input?
The ultimate joke would be making Wriggle an EX Boss, but there being a game-breaking bug in her final spellcard that made it impossible to catch.

Think about it for a second...

Drake

  • *
Re: Touhou Input Display (thinput)
« Reply #17 on: December 19, 2013, 01:53:20 AM »
guys i didn't make this to detect cheating, even though it can incidentally help when identifying cheating
Could it work out a player's APM and possibly identify cheating?
Yes, but APM by itself isn't always an accurate indicator. I tap quickly and dance fairly sporadically while I play, and if you look at just how fast and randomly the buttons pop up you might watch me and think my weird play is cheating. I know for sure that it can help, but that adding a thing to track APM, or looking at quick inputs themselves, isn't necessarily a good measure, and I don't really want to encourage witchhunts.

I dont mean to sound jerkish or anything but why would someone want this? I mean you know the guy is pushing up if they're flying up? Im clearly missing something. Regardless thanks for continuing to work on these things!
I made it mainly so I could stream with it visible in the window. It was first supposed to just read keyboard input. I don't really have a solid application intended for it, but if you find that it's useful for whatever reason then that's good enough. Personally I would like to see streamers use it, I find watching player input adds to the experience.

I'm guessing PCB uses a different method of handling input?
PCB uses a convoluted system of storing velocities and doesn't seem to actually store the state of button inputs besides having like 1 2 3 4 mean up/down/left/right the frame after input (how the other buttons happen is mysterious). It's possible to add, isn't something I care enough to do. The rest of the games all use a similar structure that makes it really easy to read without having to adjust much for different inputs for each game. EoSD and PCB would require a lot more work I'm not really willing to put in without a good reason.
« Last Edit: December 19, 2013, 01:55:02 AM by Drake »

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -

SIRookie

  • I have no idea what I'm doing
Re: Touhou Input Display (thinput)
« Reply #18 on: December 19, 2013, 06:13:47 AM »
I was actually about to start looking for something like this. There are some replays I wanted to rewatch for key movements

Re: Touhou Input Display (thinput)
« Reply #19 on: December 22, 2013, 04:17:30 AM »
This is actually very awesome. I can turn a lucky dodge into something reusable.

Re: Touhou Input Display (thinput)
« Reply #20 on: February 23, 2015, 12:07:00 PM »
sorry for the necropost.
but we have found ways to support other games:
add this to thniput.ini [addresslist]


抢曽峠杺嫿.exe, 0x69D904  <=== for Japanese version  , 东方红魔郷.exe, 0x69D770 for Chinese verision.
th07.exe, 0x4B9E50 
th095.exe, 0x4BE244
th125.exe, 0x4D8FB8
alcostg.exe, 0x471620
---------------------------------

there are some bugs for DS, may be ZUN's fault.
th143.exe, 0x4E1BE8
[Buttons]
Shot = 25, 0
Bomb = 50, 0
Slow = 125, 0
Skip = 0, 25
Up = 125, 25
Left = 150, 25
Down = 100, 25
Right = 0, 0
------------------------

Drake

  • *
Re: Touhou Input Display (thinput)
« Reply #21 on: February 24, 2015, 02:53:57 AM »
Thanks a bunch, actually! Finding working addresses for th06/07 is very useful since I wasn't able to find them myself. I did originally exclude the photo games because of the buggy buttons, but I really shouldn't have since you can always swap around the button graphics or just ignore the bugs. I'll update the first post.

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -

Re: Touhou Input Display (thinput)
« Reply #22 on: February 25, 2015, 01:25:15 AM »
for th125,use cheatengine to see 0x4D8DA0

press  z, x, shift, ctrl, up, down, left, right , they have different output values.
but in thinput , different keys have the same react.
maybe there are some bugs in this program.

Drake

  • *
Re: Touhou Input Display (thinput)
« Reply #23 on: February 25, 2015, 06:31:59 AM »
No, it's more a matter of ZUN not being consistent in how he maps the buttons to the bit flags in the vector. In particular, before th11 it goes (shot, bomb, slow, [empty], up, down, left, right, skip, [empty]). Meanwhile in th11 and on, the 4-bit is reserved and the 8-bit is slow instead (and skip goes from the 256-bit to the 512-bit), so in the program I check both 4 and 8 for slow, and both 256 and 512 for skip. But in th125, he shifts the up button and onward right one bit, so the up button gets read as slow instead (the other mismatches follow similarly).

Code: [Select]
th06 ~ th10 (except th095):
    (shot, bomb, slow, [empty], up, down, left, right, skip, [empty])
th11 ~ th143 (except th125):
    (shot, bomb, [reserved], slow, up, down, left, right, [empty], skip)
th095:
    (bomb*, shot, slow*, [empty], up, down, left, right, skip, [empty])  *bomb and slow have the same behaviour, so bomb -> 1 and slow -> 4+1
th125:
    (shot, bomb, slow, up, down, left, right, skip, [empty], [empty])  <- why zun

The forward-compatibility of this relies on the input being consistent, basically. Since th095 and th125 aren't consistent, it doesn't work as intended. Does this clear things up?
« Last Edit: February 25, 2015, 07:04:06 AM by Drake »

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -

stop shitposting and go play some shmup

Drake

  • *
Re: Touhou Input Display (thinput) ver. th15
« Reply #25 on: April 15, 2017, 04:26:15 AM »
Uh, I don't know. That shouldn't happen. Can you make sure the button isn't set to some weird negative position in the config? Because that's how you would hide the buttons. PoFV should work fine from my testing.

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -

Re: Touhou Input Display (thinput) ver. th15
« Reply #26 on: April 15, 2017, 06:58:30 AM »
i didn't change anything in files. and you misunderstood, i think. it's not permanent. It just looks like that on some frames. I was hoping that it has something to do with the problem that i encountered (was pointed at) in POFV http://www.youtube.com/watch?v=JwYGoJxomCc
stop shitposting and go play some shmup

Drake

  • *
Re: Touhou Input Display (thinput) ver. th15
« Reply #27 on: April 15, 2017, 08:40:57 AM »
Ok, that gave me the hint I needed. So the "actual" problem is that I'm dumb and didn't load the images in the correct way, so it seems to loads the image from disk every time it is needed rather than storing it in memory. You can confirm this by starting thinput, pushing a button, editing the image, then pushing a button again. Generally this will not cause any visible issues because it should be fast enough anyways, but if your framerate counter there is an actual representation of how slow your game runs, your computer might actually be bad enough that it can't load the images properly. I can't really say for sure though.

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -

Re: Touhou Input Display (thinput) ver. th15
« Reply #28 on: April 15, 2017, 01:29:34 PM »
ok
stop shitposting and go play some shmup

Enko

  • Spirit flying to anywhere
Re: Touhou Input Display (thinput) ver. th16
« Reply #29 on: May 02, 2018, 11:03:14 AM »
Sorry for my reply,
is there a way to change the size of the buttons?
e.g. Slow Button shows not so long as it should be on the keyboard.
Need help with C# DX developing.