[RGD] DirectX implementation of RGSS3

Hey @JakenBear I needed help with this a month or two ago and so I contacted my favourite bunny of the forums and he helped me out. @Sixth hope you don't mind me sharing the script you wrote up so the controller works in RGD?
Spoiler
=begin

- XInput Patch v1.1
- Made by: Sixth
- Requires: RGD

This is just a small patch to integrate RGD's XInput controller checks for all
input checks in your project without the need to add in the new controller
checks for every single input check in every script of yours.

I don't recommend using this script if you are planning to use all of the
buttons from the XBOX controller, because, by default, only 8 buttons are
supported, but an XBOX controller (and most other controllers too nowadays) has
more.

It will only check for one controller input, the first one it detects.
Well, at least it should, but since I don't own an XBOX controller, I can't
really check if it works as intended or not.

Aside from the added XInput checks for your XBOX controller, the default input
checks are still working, so the keyboard checks and the default controller
checks will still operate as they did before adding this patch.

You can put this script anywhere on your script list.

=end

module XInput

# Format:
#
# :default_symbol => [:controller_symbol_1, :controller_symbol_2, ...],
#
# Don't change the default symbols!
# You can change which controller button(s) will be assigned to the default
# input checks by changing the controller symbols on the right side in the
# arrays. The controllor symbols must be in an array!
# All included controller buttons for a default symbol will do the same when
# they are pressed.
# Refer to the RGD documentation for the available controller symbols.
#
# You can add in custom symbols as default symbols too, but they won't do
# anything until you actually check for that symbol in your input checks,
# which the default scripts don't do, so I didn't include any here.
Keys = {
😀OWN => [😀PAD_DOWN], # DOWN
:UP => [😀PAD_UP], # UP
:LEFT => [😀PAD_LEFT], # LEFT
:RIGHT => [😀PAD_RIGHT], # RIGHT
:A => [:X], # Dash key
:B => [:B], # Cancel key
:C => [:A], # Confirm key
:L => [:LEFT_SHOULDER, :LEFT_THUMB], # Page Up
:R => [:RIGHT_SHOULDER, :RIGHT_THUMB], # Page Down
:X => [:START], # Not used by default - custom scripts may use it
:Y => [:Y], # Not used by default - custom scripts may use it
:Z => [:BACK], # Not used by default - custom scripts may use it
}

end

# End of settings! Don't mess with the code below! Or do... I don't care. 😛

class << Input

attr_accessor 😛ref_ax, :dir4, :dir8

@pref_ax = ''
@dir4 = @dir8 = 0

alias add_xinput9927 trigger?
def trigger?(arg)
return add_xinput9927(arg) || xinput_check("trigger?",arg)
end

alias add_xinput7724 press?
def press?(arg)
return add_xinput7724(arg) || xinput_check("press?",arg)
end

alias add_xinput1773 repeat?
def repeat?(arg)
return add_xinput1773(arg) || xinput_check("repeat?",arg)
end

def xinput_check(mtd,arg)
control = Input::Controller.first_state || Input::Controller.states[0]
return false unless XInput::Keys[arg]
return XInput::Keys[arg].any? {|sym| control.send(mtd,sym) }
end

def update_dir
xx = get_x
yy = get_y
@dir8 = num_dir(xx,yy)
if xx != 0 && yy != 0
if @pref_ax == 'x'
yy = 0
else
xx = 0
end
elsif xx != 0
@pref_ax = 'y'
elsif yy != 0
@pref_ax = 'x'
end
@dir4 = num_dir(xx,yy)
end

def get_x
xx = 0
xx -= 1 if press?🙂LEFT)
xx += 1 if press?🙂RIGHT)
return xx
end

def get_y
yy = 0
yy -= 1 if press?🙂UP)
yy += 1 if press?🙂DOWN)
return yy
end

def num_dir(x,y)
if x != 0 || y != 0
return 5 - y * 3 + x
else
return 0
end
end

alias fix_dirs7761 update
def update
fix_dirs7761
update_dir
end

end
# END OF SCRIPT! O_O
Just chuck this in, this makes the controller work and the player walk with the d-pad, not with the analogue. Sixth would have to do some extra handling to make it work for the analogue and as they are a busy bunny I'm not sure if they would be inclined to do that.
Don't post that as a spoiler post, post it as a code insert. Sixth's script is already broken with the smiley error.
Thanks so much for taking the time to post this and @Sixth for taking the time to make it.
I'll just have to go through and pick out the 🙂
This will definitely help, thank you again.
Oops! Thanks tv.ghost. Fixed it.
Got them fixed, thank you.

xx -= 1 if press ? ( : LEFT )
xx += 1 if press? ( : RIGHT )

Thanks again
Sometimes FPS drops considerably when you use only 1 animation on the map, which ends up affecting real-time battle systems. Note: I am using 1024x608 resolution.
@Knighteriius
There are some errors still in that code. You probably just wrapped the code lines in code tags after the smileys were already converted, hence some smileys remain, just not in a picture format. For example:
Code:
press?:)LEFT)
The bracket is messed up there.

Delete the whole code from that post, and copy/paste the original one again between code tags this time. This should fix all the errors in it.
Great, was looking for the XBOX Controller add-on myself too 😀
I was look for a XBOX controller too
So how come this project is ok, but this other guy was told he was reverse engineering? (As he found out what functions were in the DLL)

https://forums.rpgmakerweb.com/index.php?threads/is-this-legal.33330/

Just wondering.
First, you probably missed this part:
OK, this is not an official Degica/Enterbrain statement
which means there was no official statement saying it was wrong.

And second, all the previously hidden classes can now be obtained from MV, which has no hidden classes at all. Even if they are written using a different language, they should work pretty much in the same way.
Mv classes/code is NOT ace classes/code. Yes, the logic may** be similar, it also may not, we will never know...

That being said - this system, and the one I wrote from the thread linked above, DO NOT USE HIDDEN CLASSES!!!! So that argument is 100% irrelevant tbh.

The reason that my system was disallowed was because I used calls that are not officially documented from the rgss301.dll file. This sytem does exactly that same thing. Thus, this system should have never been allowed - as mine, and other people who worked really freakin hard, got told to stop. But like I said on page3/4 of this thread. I'm not really complaining - this is a cool project and its great they allowed it..

Would have just been nice if they let us do it like 4 years earlier. The engine as a whole would have been so much better for it.. Like, this guy, wouldnt have had to write it, cause we did, then he coulda spent time doing some other awesome engine addition, thus, a better engine overall, for all..

Anyway, im ranting now... 😀
which means there was no official statement saying it was wrong.

It did come from a staff member, which is the next best thing and no other staff came forward stating to the contrary. But that thread was full of 'no it is illegal' type posts and this one is 'full of good job' posts. Just seems that some devs are 'more equal than others'.
Thus, this system should have never been allowed - as mine, and other people who worked really freakin hard, got told to stop.
It did come from a staff member, which is the next best thing and no other staff came forward stating to the contrary.

As you can see from the post I quoted in the previous message, that very same staff member highlighted the fact that what he said was not an official statement. This means that, in truth, nobody told you to stop, and nobody had to say the contrary at all, since it was not official. If I tell you "you should stop, but I am not 100% sure" it does not mean "you have to stop". This and that are two different things, and this is an undeniable fact, not a matter of opinions.

That said, I do not know what the OP did to receive the approval, but I cannot see how this should not be allowed when other things were not officially stopped either. In the end, if the OP wanted to pursue this matter further, contacting Degica and receiving legal help with this matter, it is something we now nothing about - and since we are not th OP it is also something that should not concern us.

However, there are a couple of things that we know as a fact:
  • there was no official statement saying that something like this cannot be done;
  • this thread has been approved.
Can you honestly say that those two things are in conflict with each other? I see no conflict there to be honest. If your concern is about why two things that look very similar are not treated equally. We, as game designers, should be the very first ones to know that we should not judge things based on appearance. Two games with almost identical dynamics might have different mechanics generating them...the same could have happened here, and we are not allowed to know what exactly happened. The only thing we know is that those two things are not in conflict with each other, and that should leave enough room for something like this to be approved.

However, I do not think we should discuss something like this to be honest. Since this has been approved, it means that it does have something different from other similar things that were done before (be it more effort from a legal standpoint, or something different in the code, that is something I do not know). Even the very same thing might be wrong in a certain situation, but right in a different situation. And this is why I mentioned MV. Even if the logic is not necessary the same thing, it is visible, and allows people to change it as much as they want. That might have caused a change in circumstances that made the same thing right in this point in time. Whatever the reason, discussing about that is useless since there are too many undetermined factors that we (as third parties) are not allowed to know.

We can keep discussing about them, we can keep guessing, but in the end, every conclusion we might achieve has the same chance of being true as any other conclusion (right or wrong, it does not matter). The only result would be a growing resentment, and I cannot see how that can be useful. The world is full of things that have different results when made at different times, even more so the world of games. Just be happy that finally a DirectX implementation of RGSS3 has been approved and use it if you want to. Discussing about the reason why it has been approved, without knowing what happened behind the curtains, is completely useless.
TBH, I highly doubt anything happened 'behind the curtains' - I tried to get information for contacting Degica directly (for this issue), got absolutely no where. But yea, you are right, there is certainly no point in speculating why this is allowed now..

The main point is - this thread PROOVES that calling functions from the rgss301.dll file IS ALLOWED regardless of what every single other mod and forum staff has stated in the past. - and thats very very sweet imo (even though i no longer use ace) 😀
I remember when this was opened, and we checked and they wrote their own dll. That is why it was allowed. Maybe staff can weigh in more though.
We redefined Ruby methods in C++, like we do that in Ruby. The methods are defined in runtime.
We used functions from the RGSS dll, some of which are not in the export table. My partner Fux2 found them one by one manually.

^ This is what I had done and was told it was disallowed - I also was not the one who found the functions, I just called them 🙂
Odd, as per this: https://www.law.cornell.edu/uscode/text/17/1201#

Section F says (if I read it correctly) it has to be allowed per the Millenium Digital Copyright Act, as long as it is adding interopability to the program, and is not used to make a competing product (there's a separate law in 1981 for the no competing product one, I didn't save the link). I think adding a new feature or improving compatibility would count.
Damn dude, where was that information when I was getting pooped all over in this thread lmao - where to request official apology ? 😛 (i jest)

But its good to know for sure that things like this are allowed now. Raises a whole host of possibilities for future ace developers (as rare as they are 😀)
I wouldn't take mine as an official statement. Wait til staff weighs in. In just going off of what I remember plus internet research which both can be incorrect
ahh, no need to have staff weighing in - i wouldnt want this project to get shut down even if it wasnt allowed lol , so lets just not dredge up the past any further? 😛

Original thread: https://forums.rpgmakerweb.com/threads/rgd-directx-implementation-of-rgss3.95228/