bkenobi Posted December 24, 2008 Share Posted December 24, 2008 I was viewing the XPadder forums a while back and found a post where Jonathan (the author of the program) discussed how he modified the MAME source code to once again work with XPadder. This mod would make it possible to use AHK etc once again too. Here's what he wrote (I would link the post, but the forum is no longer available):Converting MAME to handle Xpadder is very easy (if you know how to compile MAME - see the MAME site for technical info) so here's how I did it. Download the source files and edit src/osd/windows/input.cSearch for:// initialize RawInput and DirectInput (RawInput first so we can fall back)rawinput_init(machine);dinput_init(machine);win32_init(machine);and remove the line: rawinput_init(machine);That's it! Now MAME will always fallback to DirectInput (the original keyboard reading method). When you compile the new source it will throw up some errors of procedures or values that are not used. Just delete them from input.c and compile again. Do this a few times until the compilation manages to complete.So the question is, is this a good idea or are there potential negative ramifications from disabling the raw input system? This is a really simple change and would allow for a lot of control to be given back to the user, but if it will screw things up in a big way then it's not worth it.Comments? 1 Link to comment Share on other sites More sharing options...
Brian Hoffman Posted December 24, 2008 Share Posted December 24, 2008 I was viewing the XPadder forums a while back and found a post where Jonathan (the author of the program) discussed how he modified the MAME source code to once again work with XPadder. This mod would make it possible to use AHK etc once again too. Here's what he wrote (I would link the post, but the forum is no longer available):So the question is, is this a good idea or are there potential negative ramifications from disabling the raw input system? This is a really simple change and would allow for a lot of control to be given back to the user, but if it will screw things up in a big way then it's not worth it.Comments?Very good find. I am sure some will find this usefull. Link to comment Share on other sites More sharing options...
Tempest Posted December 24, 2008 Share Posted December 24, 2008 Yep, this would have saved me some time when I did the CFG's... But I am going to bookmark this for future reference! Link to comment Share on other sites More sharing options...
fRequEnCy Posted December 24, 2008 Share Posted December 24, 2008 Very good find indeed. I would say it would be useful to some. Thanks bkenobi for the post! Link to comment Share on other sites More sharing options...
headkaze Posted December 24, 2008 Share Posted December 24, 2008 I read the same thing a while ago but didn't realise it was such a simple change.I was considering adding my Raw Input injection system into the XLaunch wrapper I'm working on but I've never thought people needed to send keys to Mame anymore. I mean in most cases you can just reconfigure keys in Mame's config. Is there really any usefulness to injecting keys into Mame? Is it for some special key remapping I haven't thought of or for things like dropping in credits and things like that? Link to comment Share on other sites More sharing options...
bkenobi Posted December 25, 2008 Author Share Posted December 25, 2008 I think one thing would be to allow for more dynamic controls remapping. If you wanted to have controls set up a certain way for a set of games, it would be easy to put together a list and call xpadder with that config. I don't think it's as useful now that Tempest's control remapping script is available. It's a bit of work, but probably less work than putting a script together to change xpadder profiles.I think the more useful thing is being able to send commands from other programs that aren't in raw format. For instance, I haven't tried it yet but it might make using WinGun with the most current version of MAME possible again. The guns track, but they don't fire. I suspect it's the raw system that might be partially to blame for this.Anyway, just thought I would throw the info out there since it's been lost from the other forum. Link to comment Share on other sites More sharing options...
Brian Hoffman Posted January 23, 2009 Share Posted January 23, 2009 EDIT : THIS DOES NOT WORK!Its even easier than removing the new input system.. Just do this// initialize RawInput and DirectInput (RawInput first so we can fall back)rawinput_init(machine);dinput_init(machine);win32_init(machine);To// initialize RawInput and DirectInput (DirectInput first so we can fall back)dinput_init(machine);rawinput_init(machine);win32_init(machine);Now you dont have any ramifications with removing the other input system...Boo Ya.. Now My AHK scripts can send keys to mame.Woo Hoo Link to comment Share on other sites More sharing options...
fRequEnCy Posted January 23, 2009 Share Posted January 23, 2009 Its even easier than removing the new input system.. Just do this// initialize RawInput and DirectInput (RawInput first so we can fall back)rawinput_init(machine);dinput_init(machine);win32_init(machine);To// initialize RawInput and DirectInput (DirectInput first so we can fall back)dinput_init(machine);rawinput_init(machine);win32_init(machine);Now you dont have any ramifications with removing the other input system...Boo Ya.. Now My AHK scripts can send keys to mame.Woo HooNice! Maybe someone can create a patch that will take care of it so you can apply it when compiling instead of manually editing the code? Link to comment Share on other sites More sharing options...
bkenobi Posted January 23, 2009 Author Share Posted January 23, 2009 Nice catch!So, the question is....what are the ramifications to doing this? What do you lose by turning off the raw input system. Or, what do you currently gain by having the raw input system? I still don't know what the advantage is, so I'm nervous about turning it off. Link to comment Share on other sites More sharing options...
Brian Hoffman Posted January 23, 2009 Share Posted January 23, 2009 Nice catch!So, the question is....what are the ramifications to doing this? What do you lose by turning off the raw input system. Or, what do you currently gain by having the raw input system? I still don't know what the advantage is, so I'm nervous about turning it off.My guess is multiple keyboard.. As AHK sends keys to it it cannot tell if AHK is sending the key or my keyboard is. Where as before it didnt accept it.. Link to comment Share on other sites More sharing options...
Tempest Posted January 23, 2009 Share Posted January 23, 2009 I like your new new avatar Frequency! Link to comment Share on other sites More sharing options...
fRequEnCy Posted January 24, 2009 Share Posted January 24, 2009 I like your new new avatar Frequency!LOL. Thanks! Had to change it up and do it simple. Looks better at it's actual size. Link to comment Share on other sites More sharing options...
Brian Hoffman Posted January 24, 2009 Share Posted January 24, 2009 Guys I think I may have jumped the gun.. I thought my when I had remaped some key in AHK and it worked that send input would.. Im going to look more into this.Sorry Link to comment Share on other sites More sharing options...
bkenobi Posted January 24, 2009 Author Share Posted January 24, 2009 Definitely keep us posted. I'm thinking more about doing this to have my gun games back in standard MAME again. If this works, I'm golden! Link to comment Share on other sites More sharing options...
bkenobi Posted March 17, 2009 Author Share Posted March 17, 2009 Just curious if anyone has worked on this any further. I'm stepping up to MAME 0.130 and thinking of incorporating this hack in as well. If it works, I'll be using my guns with modern versions of MAME! Just curious if there have been any drawbacks found (or if it really works)? Link to comment Share on other sites More sharing options...
headkaze Posted March 18, 2009 Share Posted March 18, 2009 Take a look in src\osd\windows\input.c and change// For testing purposes: force DirectInput#define FORCE_DIRECTINPUT 0to// For testing purposes: force DirectInput#define FORCE_DIRECTINPUT 1That should do it. 2 Link to comment Share on other sites More sharing options...
bkenobi Posted March 18, 2009 Author Share Posted March 18, 2009 Wow, that's it! I'll give it a try. Thanks for the input. Link to comment Share on other sites More sharing options...
bkenobi Posted March 19, 2009 Author Share Posted March 19, 2009 I just looked at the code and I don't know why I didn't see that in the first place...it's on one of the first lines of code and documented pretty clearly that it will turn off the raw input system. Thanks for the advice, I'm going to check this out now! Link to comment Share on other sites More sharing options...
bkenobi Posted March 23, 2009 Author Share Posted March 23, 2009 I just wanted to post an update now that I've had a chance to play a few games. I applied the mod that HK's suggested above:#define FORCE_DIRECTINPUT 1This works GREAT! I have both guns working in MAME just fine! MAME also detects XPadder keys, so it should work with any other script as well. This should simplify things pretty nicely for me now as I won't have to keep an old copy of MAME and old roms specifically for gun games any more. AWESOME! Now if I could just figure out how to update the MAME Analog+ code for the current version of MAME, I'd be down to a single version! Link to comment Share on other sites More sharing options...
Tempest Posted March 23, 2009 Share Posted March 23, 2009 Glad it works! It was HeadKaze's suggestion though... Link to comment Share on other sites More sharing options...
bkenobi Posted March 23, 2009 Author Share Posted March 23, 2009 Woops, my bad. Yes, HK's suggestion. Link to comment Share on other sites More sharing options...
chriss Posted August 26, 2009 Share Posted August 26, 2009 hey guys i need a little help herei'm trying to have mame plus exit when two keys are pushed for 2 seconds or longer.so i compiled mame plus 0.133 with this// For testing purposes: force DirectInput#define FORCE_DIRECTINPUT 1my ahk script to exit that works for all emulator is this one:; <COMPILER: v1.0.47.6>#InstallKeybdHook#SingleInstance forceQuitWaitTime:=0#PersistentSetTimer, WatchQuitCombo, 250returnWatchQuitCombo:if GetKeyState("5") AND GetKeyState("c"){ SetTimer, ComboQuitDown, 100 SetTimer, WatchQuitCombo, Off}returnComboQuitDown:if GetKeyState("5") AND GetKeyState("c"){ QuitWaitTime:=QuitWaitTime + 100 if QuitWaitTime >=2000 { Send {Blind}{Escape} QuitWaitTime:=0 SetTimer, WatchQuitCombo, 250 }}Else{ QuitWaitTime:=0 SetTimer, WatchQuitCombo, 250}returnnow i set mame to exit on the ESC Button but it's still not responding to this? DOes anybody know what is going wrong here? Link to comment Share on other sites More sharing options...
headkaze Posted August 27, 2009 Share Posted August 27, 2009 You know that you can set Mame to exit on a key combo? Of course there is no timer function though. Link to comment Share on other sites More sharing options...
chriss Posted August 27, 2009 Share Posted August 27, 2009 yeah i was using the same key combo before, but sometimes people were ending games by accident so a delay timer would be really nice!HK, do you have any idea what could be the problem here? Link to comment Share on other sites More sharing options...
Adultery Posted September 24, 2011 Share Posted September 24, 2011 Take a look in src\osd\windows\input.c and change// For testing purposes: force DirectInput#define FORCE_DIRECTINPUT 0to// For testing purposes: force DirectInput#define FORCE_DIRECTINPUT 1That should do it.Big shout to HK for helping me before I even knew I needed it! This works great!! Too bad it's not a tick box in Mame Compiler 64, but I can do it this way too. Link to comment Share on other sites More sharing options...
Recommended Posts