Gamepad Extender (v1.1, 2/20/2015)

I've moved stuff to a new project and there was the same issue, so it definitely has to be something with the emulator dll.


I have no idea where's the source of trouble.


Hmm... Since it does work for you ~ could you lend me your dll/configuration file with your settings? I'd check stuff out.


By the way, that's the scene, where I'm testing Input from pads:

Spoiler
Code:
class Scene_Test < Scene_Base
  #-----------------------------------------------------------------------------
  # >>> Start Processing
  #-----------------------------------------------------------------------------
  def start
    super
    create_text
  end
  
  #-----------------------------------------------------------------------------
  # >>> Create Text
  #-----------------------------------------------------------------------------
  def create_text
    @v1 = 0
    @v2 = 0
    
    @text = Sprite.new
    @text.bitmap = Bitmap.new(640,480)
    @text.bitmap.draw_text(150, 220, 450, 30, "PLAYER 1   PLAYER 2")
    @text.bitmap.draw_text(100, 290, 450, 30, "PRESS KEYS TO CHANGE NUMBERS")
    
    @text1 = Sprite.new
    @text1.bitmap = Bitmap.new(100, 30)
    @text1.x = 160
    @text1.y = 250
    @text1.bitmap.font.color = Color.new(0,255,255)
    @text1.bitmap.draw_text(0, 1, 100, 30, @v1, 1)
    
    @text2 = Sprite.new
    @text2.bitmap = Bitmap.new(100, 30)
    @text2.x = 330
    @text2.y = 250
    @text2.bitmap.font.color = Color.new(0,255,255)
    @text2.bitmap.draw_text(0, 1, 100, 30, @v2, 1)
  end
  
  def update_text
    @text1.bitmap.clear
    @text1.bitmap.draw_text(0, 1, 100, 30, @v1, 1)
    @text2.bitmap.clear
    @text2.bitmap.draw_text(0, 1, 100, 30, @v2, 1)
  end

  #-----------------------------------------------------------------------------
  # >>> Update
  #-----------------------------------------------------------------------------
  def update
    super
    if WolfPad.trigger?(:UP, 0) || WolfPad.trigger?(:L_UP, 0)
      @v1 += 10; update_text; end
    if WolfPad.trigger?(:DOWN, 0) || WolfPad.trigger?(:L_DOWN, 0)
      @v1 -= 10; update_text; end
    if WolfPad.trigger?(:LEFT, 0) || WolfPad.trigger?(:L_LEFT, 0)
      @v1 -= 1; update_text; end
    if WolfPad.trigger?(:RIGHT, 0) || WolfPad.trigger?(:L_RIGHT, 0)
      @v1 += 1; update_text; end
    if WolfPad.trigger?(:A, 0)
      @v1 += 100; update_text; end
    if WolfPad.trigger?(:X, 0)
      @v1 -= 100; update_text; end
    if WolfPad.trigger?(:START, 0)
      @v1 += 333; update_text; end
    if WolfPad.trigger?(:SELECT, 0)
      @v1 -= 333; update_text; end
      
    if WolfPad.trigger?(:UP, 1) || WolfPad.trigger?(:L_UP, 1)  
      @v2 += 10; update_text; end
    if WolfPad.trigger?(:DOWN, 1) || WolfPad.trigger?(:L_DOWN, 1)
      @v2 -= 10; update_text; end
    if WolfPad.trigger?(:LEFT, 1) || WolfPad.trigger?(:L_LEFT, 1)
      @v2 -= 1; update_text; end
    if WolfPad.trigger?(:RIGHT, 1) || WolfPad.trigger?(:L_RIGHT, 1)
      @v2 += 1; update_text; end
    if WolfPad.trigger?(:A, 1)
      @v2 += 100; update_text; end
    if WolfPad.trigger?(:X, 1)
      @v2 -= 100; update_text; end
    if WolfPad.trigger?(:START, 1)
      @v2 += 333; update_text; end
    if WolfPad.trigger?(:SELECT, 1)
      @v2 -= 333; update_text; end
  end
    
  #-----------------------------------------------------------------------------
  # >>> Terminate
  #-----------------------------------------------------------------------------
  def terminate
    super
    dispose_graphics
  end
  
  #-----------------------------------------------------------------------------
  # >>> Dispose
  #-----------------------------------------------------------------------------
  def dispose_graphics
    instance_variables.each do |varname|
      ivar = instance_variable_get(varname)
      if ivar.is_a?(Sprite)
        ivar.bitmap.dispose
        ivar.dispose
      end
    end
  end
end
@Lone Wolf, here's how I've set it up:

Code:
#--------------------------------------------------------------------------
  # alias method: update_show_fast
  #--------------------------------------------------------------------------
  alias window_message_update_show_fast_ams update_show_fast
  def update_show_fast
    @show_fast = true if (Input.press?(YEA::MESSAGE::TEXT_SKIP) || WolfPad.press?(:R1))
    window_message_update_show_fast_ams
  end
  
  #--------------------------------------------------------------------------
  # overwrite method: input_pause
  #--------------------------------------------------------------------------
  def input_pause
    self.pause = true
    wait(10)
    Fiber.yield until Input.trigger?(:B) || (Input.trigger?(:C) || WolfPad.press?(:A)) || Input.press?(YEA::MESSAGE::TEXT_SKIP)
    Input.update
    self.pause = false
  end
@Rikifive I don't use an emulator myself, or I'd be able to help more with that. Someone being clever probably hard-coded something to return Controller 1's input if Controller 2 couldn't be found, without properly considering the consequences.


@AceOfAces_Mod You're mixing press? and trigger? calls. As I explained before, the two are not interchangeable. For both of those methods, you want to use Input.trigger? and not Input.press? As a rule, press? should never be used on menus, as it executes every frame.
I see ~ I'll try to look up for that issue on the web ~


Thanks for your time.


WtvmtpT.png



I can't find anything on the web ~ or I'm using bad keywords ~ I've tried many things, but with no luck.


If I'll setup the configuration when one controller is plugged in, everything will work, but when I'll setup the settings while having two plugged in (and both configured), then when there's no second controller plugged in, then the game fills that empty slot by duplicating plugged one into them.


So I think, that if I'd setup the configuration for 4 controllers, then when I'd plug in only one, it would be duplicated into all 4 slots.


Welp, I guess I'll have to deal with this... Or eventually finally leave RPG Maker and move to more appropriate engine or something.


Once again, thanks for help ~ it's always better to have it kinda bugged, than not at all.
On a whim, I tried out the script you gave me with two controllers running (redundantly) through x360ce (both a version from 2011 and the current build), and alternately turning one or the other off, but was still unable to duplicate inputs in the way you describe. Are you absolutely sure you didn't just derp somewhere in your actual code and script Player 2 to check both?
Hmm... that's odd...


I've made a new project, where there was only your script and the one I've posted and the same thing happened...


Actually perhaps I broke your script somehow? I'll try redownloading your script and see if this helps.


*doing stuff*


NOPE! The same issue. =/


So it definitely comes from the emulator or... perhaps the USB slots/controllers themselves? Perhaps the issue appears only for me? Then it wouldn't be bad in the end, because as a developer I can cheat anyway if I'd like to ~ The potential players are important, not me.


Hmm... So.. there is a chance, that if I'll release the game as is, the bug actually will not exist for the others, which would be great.


Though I'm curious why it is like this, but as long as the issue happens only to me, then I don't mind that.


We'll see what will happen ~  thanks for information and your time.
BTW... Is that for VX Ace or MV?  I'm kinda lost now.
@Marquise*, it's for VX Ace.
Yes SIR!  Not that I play with a game pad; but I always see an appeal!
I am terribly sorry to bother with such a noobish question, but how to you get the D-Pad to work? I'm using a PS4 controller, and the control sticks (obviously) work fine, and my buttons are working to my satisfaction as well. But I REALLY would like to get the D-Pad working, seeing as scrolling through menus and commands during battle is a thing...and it's not exactly comfortable to do with the control stick, y'know?
Are you asking this before or after setting up this script (well, not really a script) in your own project?


The short answer is I got the D-Pad to work by entirely replacing the existing input handling. Separating D-Pad input from the analog sticks isn't possible in the default engine.
I am terribly sorry to bother with such a noobish question, but how to you get the D-Pad to work? I'm using a PS4 controller, and the control sticks (obviously) work fine, and my buttons are working to my satisfaction as well. But I REALLY would like to get the D-Pad working, seeing as scrolling through menus and commands during battle is a thing...and it's not exactly comfortable to do with the control stick, y'know?
Are you asking this before or after setting up this script (well, not really a script) in your own project?


The short answer is I got the D-Pad to work by entirely replacing the existing input handling. Separating D-Pad input from the analog sticks isn't possible in the default engine.



If you don't feel like doing that yourself, I did make a script for that (it still requires Gamepad Extender to work). http://forums.rpgmakerweb.com/index.php?/topic/69589-ge-game-adapter/
So, I have a Logitech Dual Action. Will it work?


Or, will I need extra help?


I currently do have Logitech Wingman installed for extra controller mapping functionality...
@Reapergurl If it uses XInput (which most modern game controllers for PC do), it should work just fine. You may need to go through the process of figuring out what button is recognised as what, but that should be as simple as asking "If this were an XBox controller, what button would be here instead?".
Simplest way is to add the line WolfPad.test to the beginning of Main (before rgss_main) and run your project with the pad you want to test plugged in and the console open. That will tell you how many controllers you have that were detected by XInput.DLL.
@Lone Wolf I actually didn't know that (despite making my own script that requires this to work). I feel so silly now, but thank you. I'm sure that @Reapergurl will appreciate that too.
I mean, it's undocumented debug code, but I tried to make it easy enough to find if someone went looking.
@Lone Wolf Which I did do (my script adds methods to the WolfPad module in order to work, so I had to check if said method didn't already exist). That's why I feel silly.
What you should know, then, is that the best function for testing is actually WolfPad.readout, which shows you the exact controller state for that frame, if you can make sense of it.
@Lone Wolf Yeah. I'll keep that in mind if I ever need to do testing.

Original thread: https://forums.rpgmakerweb.com/threads/gamepad-extender-v1-1-2-20-2015.1284/