Patch:Nojoy

From Touhou Patch Center
Jump to: navigation, search

Disable joystick support (nojoy)

Depends on

nmlgc/base_tsa, nmlgc/base_tasofro

(adapted from https://gist.github.com/iamgreaser/5651429)

Here, have some patches.

These are patches to disable joystick support for when you'd rather have a joy-to-key mapper than the terribleness that is 99% of games with joystick support not being able to handle a 28-axis controller properly.

You must tick the "Don't use DirectInput for joystick" box for this to actually work, as it doesn't touch those.

Also, these are for the latest (as of writing) full versions.

The general procedure is:

  • Look for all instances of joyGetPosEx - there should be exactly 3.
  • Make the code pretend that it always returns a nonzero value in all 3 cases.

For instance, this is one of the relevant places in TH07's disassembly:

ALIGN 16
?_03773:push ebp ; 00430290 _ 55
mov ebp, esp ; 00430291 _ 8B. EC
sub esp, 52 ; 00430293 _ 83. EC, 34
mov dword [ebp-34H], 52 ; 00430296 _ C7. 45, CC, 00000034
mov dword [ebp-30H], 255 ; 0043029D _ C7. 45, D0, 000000FF
lea eax, [ebp-34H] ; 004302A4 _ 8D. 45, CC
push eax ; 004302A7 _ 50
push 0 ; 004302A8 _ 6A, 00
call near [imp_joyGetPosEx] ; 004302AA _ FF. 15, 0048D220(d)
test eax, eax ; 004302B0 _ 85. C0
jz ?_03774 ; 004302B2 _ 74, 18
; ^ NOP this opcode with two 0x90 bytes
push ?_15147 ; 004302B4 _ 68, 00497D9C(d)
push ?_15997 ; 004302B9 _ 68, 00624210(d)
call ?_03849 ; 004302BE _ E8, 0000132D
add esp, 8 ; 004302C3 _ 83. C4, 08
mov ax, 1 ; 004302C6 _ 66: B8, 0001
jmp ?_03775 ; 004302CA _ EB, 15

If on the other hand it's a jnz or something that doesn't include zero, you'll need to find what byte to use for a force jump.

Said one other case I have is for a longer-than-usual conditional jump, which involves changing 0F 85 to 90 E9.

Enjoy!

-- GreaseMonkey

Icon th06.png Embodiment of Scarlet Devil (th06)

Disable joystick support
(nojoy)
Address
v1.02h0x41cf82, 0x41d00a, 0x41d6d5
Code
  1. 90 90
  1. nop (*2)

Icon th07.png Perfect Cherry Blossom (th07)

Disable joystick support
(nojoy)
Address
v1.00b0x4302b2, 0x430436, 0x430a0a
Code
  1. 90 90
  1. nop (*2)

Icon th08.png Imperishable Night (th08)

Disable joystick support
(nojoy)
Address
v1.00d0x43d0e2, 0x43d166, 0x43d82a
Code
  1. 90 90
  1. nop (*2)

Icon th09.png Phantasmagoria of Flower View (th09)

Disable joystick support (long jump)
(nojoy_long)
Address
v1.50a0x42b61f, 0x42b78e
Code
  1. 90
  2. e9
  1. nop
  2. jmp ...
Disable joystick support
(nojoy)
Address
v1.50a0x42c915
Code
  1. 90 90
  1. nop (*2)

Icon th10.png Mountain of Faith (th10)

Disable joystick support (long jump)
(nojoy_long)
Address
v1.00a0x44a1ff, 0x44a53c
Code
  1. 90
  2. e9
  1. nop
  2. jmp ...
Disable joystick support
(nojoy)
Address
v1.00a0x44a0e5
Code
  1. 90 90
  1. nop (*2)

Icon th11.png Subterranean Animism (th11)

Disable joystick support (long jump)
(nojoy_long)
Address
v1.00a0x45760c
Code
  1. 90
  2. e9
  1. nop
  2. jmp ...
Disable joystick support
(nojoy)
Address
v1.00a0x4571c5, 0x4572cf
Code
  1. 90 90
  1. nop (*2)

Icon th12.png Undefined Fantastic Object (th12)

Disable joystick support (long jump)
(nojoy_long)
Address
v1.00b0x462e1c
Code
  1. 90
  2. e9
  1. nop
  2. jmp ...
Disable joystick support
(nojoy)
Address
v1.00b0x4629d5, 0x462adf
Code
  1. 90 90
  1. nop (*2)

Icon th128.png Fairy Wars (th128)

Disable joystick support (long jump)
(nojoy_long)
Address
v1.00a0x468d7c
Code
  1. 90
  2. e9
  1. nop
  2. jmp ...
Disable joystick support
(nojoy)
Address
v1.00a0x46891f, 0x468a3f
Code
  1. 90 90
  1. nop (*2)

Icon th13.png Ten Desires (th13)

Disable joystick support (long jump)
(nojoy_long)
Address
v1.00c0x47157c
Code
  1. 90
  2. e9
  1. nop
  2. jmp ...
Disable joystick support
(nojoy)
Address
v1.00c0x4710df, 0x4711ff
Code
  1. 90 90
  1. nop (*2)

Icon th14.png Double Dealing Character (th14)

Disable joystick support (short jump)
(nojoy_short)
Address
v0.01a0x401bfc
v0.01b0x401bfc
Code
  1. eb
  1. jmp ...
Disable joystick support
(nojoy)
Address
v0.01a0x4017dc, 0x4017ec, 0x40190d
v0.01b0x4017dc, 0x4017ec, 0x40190d
Code
  1. 90 90
  1. nop (*2)