Status
Not open for further replies.

ShadowDragon

Veteran
Veteran
Joined
Oct 8, 2018
Messages
3,373
Reaction score
1,258
First Language
Dutch
Primarily Uses
RMMV
if you look at the iputs (I cannot tell what 1 and 2 means in 1,18,2.

18 probably refered to "alt key", as for 164 and 165, I cannot tell which
button those referred too out of my hand, but it is probably a disable, enable,
go in fullscreen or window mode (so far I see the full script)

but my guess it's the key press on press and release.
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,184
Reaction score
838
First Language
Hungarian
Primarily Uses
RMVXA
Code:
inputs = [1,18,2, 1,164,2, 1,165,2].pack('LSx2Lx16'*3)
This contains 3 keyboard press triggers.
One trigger contains 3 numbers in that array ( [1,18,2], [1,164,2] and [1,165,2] ).
The numbers in each of these are:
  1. The type of the input trigger. 0 = Mouse, 1 = Keyboard, 2 = Hardware.
  2. The keycode of the input. Must be a value between 1 and 254 for keyboard triggers. With this, you specify the key triggered. Note that the available values here depend on which type of input you choose (mouse, keyboard or hardware).
  3. This can be 1, 2, 4 and 8 or their combinations. I won't go into details, but 2 means that the key will be released.
And the 'LSx2Lx16'*3 part will format these into a string format, since that is required for the SendInput api to work. The *3 part should probably match the amount of key triggers you used in the input array, forgot about this part.

Code:
SendInput.call(3, inputs, 28)
The 3 in here must be the size of the input array.
The inputs is the input array itself, of course.
And the 28 is the size of the input array in bytes.

If you want to read more about it:
Follow the relevant links in there to backtrack to any information you may need.
 

zeroscares

Veteran
Veteran
Joined
Oct 17, 2020
Messages
97
Reaction score
19
First Language
português
Primarily Uses
RMVXA
perfect! Thanks Sixth and ShadowDragon :cutesmile:
 

Traverse

Veteran
Veteran
Joined
Jul 3, 2014
Messages
165
Reaction score
106
First Language
English
Primarily Uses
As Sixth and ShadowDragon answered, it's an API call to the Win32 API to try and block you from entering the "regular" fullscreen mode using Alt+Enter. The Win32 API has a function called "SendInput" which is meant to forcibly generate keydown presses even when no keys are being pressed - or, in this case, forcibly generate a keyup release even when a key is being pushed.

In this particular case, it's attempting to force 3 keyups at once, all variations of the Alt key.

Since the Win32 API isn't natively Ruby, he had to feed the parameter data into the SendInput function call in the form of a raw byte string. Which he had to manually construct from an array of numbers, using the Ruby Array's "pack" method.
18 probably refered to "alt key", as for 164 and 165, I cannot tell which
"18" is supposed to be (or get converted/"packed" into) the Virtual Key Code for the Alt key (which is 0x12). 164 and 165 are supposed to get converted into the less common vKey Codes for the individual "Left Alt" and "Right Alt" keys, which are 0xA4 and 0xA5.

If you look at the thread for the Fullscreen++ script, you will see the creator only added those other two after someone pointed out that his script didn't prevent the Right-Alt key from working.

Unfortunately, it didn't actually manage to solve that problem (and I can confirm that it currently doesn't stop me Alt+Entering with my keyboard Right-Alt key either) although it seemingly does block some other button combos using Right-Alt like Alt+F4.
The 3 in here must be the size of the input array.
The inputs is the input array itself, of course.
And the 28 is the size of the input array in bytes.
3 represents the number of "input commands" being sent, although I don't think it actually has to be the size of the input array/string, it's just that if it's any smaller, it ignores the rest of the input commands beyond the number specified.

The 28 also isn't the size of the entire input, it's the size of each individual input command.

The first 4 bytes are meant to denote the input type of the command (MOUSEINPUT, KEYBDINOUT or HARDWAREINPUT). The rest of the bytes depends on which type it was, and in this case it was KEYBDINPUT, which takes 7 parameters plus one optional one (two 16-bit WORDs, five 32-bit DWORDs and an optional 64-bit long which wasn't being used here and left out).

So in this case, the next 2 bytes are meant to be for the Virtual Key Code, the 2 after that for possible Hardware Scan Code, then the next 20 bytes for five additional 4-byte parameters/arguments that KEYBDINPUT takes (extended key, keyup, scan code, unicode, time).

That's 28 bytes all up.

But only two of those parameters were actually being used (vKey Code and Keyup), so the value of every other byte was simply 00 (-_-).

The pattern he was using to "pack" the numbers in his array means:
Code:
'LSx2Lx16'

L = Turn the first value in the array into a 4-byte hexadecimal integer.
S = Turn the second value into a 2-byte hex integer
x = Generate an empty byte.
2 = Do it twice, so we now have 2 empty bytes in a row.
L = Turn the third value in a 4-byte hex integer.
x = Generate more empty bytes.
16 = ....except do it 16 more times instead of just twice.
And then of course he used "*3" to make the pattern become "LSx2Lx16LSx2Lx16LSx2Lx16" so it would cover all 9 numbers in the array he wanted to convert.
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
8,137
Reaction score
5,374
First Language
Dutch
Primarily Uses
RMXP

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Latest Threads

Latest Posts

Latest Profile Posts

Going live at 2pm EST
Today is the day! I will be productive in game dev work! I will - *gets distracted by cat playing with her toy mouse* Awww <3
Whelp. I tried to be productive.
Decided to work on Fandom Scouts today. I've decided that instead of using the generic "scrolling text" event that MV has (I'm using MV for FS, not MZ) I'll use the movie option. I'm still trying to find a way to get Premiere Pro to output the compatible format though. If anyone can give me some help, it would be greatly appreciated!
Barthdry wrote on tln143's profile.
Hello tln143 Welcome to the RPG Maker Forum. We wish you enjoy and make good rpg games
Barthdry wrote on 00cassiesmells's profile.
Hello 00casiemells Welcome to the RPG Maker Forum. We wish you enjoy and make good rpg games

Forum statistics

Threads
109,037
Messages
1,041,521
Members
141,523
Latest member
Zereitzu
Top