Twin stick mod and FULL XBOX controller support

Anything to do with GTA1/GTA2 modding (tools, scripts and more).
Dege
Mugger
Mugger
Posts: 12
Joined: 04 Apr 2018, 21:06

Re: Twin stick mod and FULL XBOX controller support

Post by Dege »

1 & 2) The MISI version that this mod use is the latest one rebuilded with some additional function (the base MISI mised some functionalities needed for this mod). It's possible that one of my modification or the lua script caused MISI to self-unload.
3) I'll try to look into it, can you describe step by step describe what are you doing and what happen? Are you pausing the game or entering the menù? (on the controller the button are mapped in this way: Back -> Quit | Start -> Pause)
TempUser_
Mugger
Mugger
Posts: 16
Joined: 07 Aug 2017, 17:08

Re: Twin stick mod and FULL XBOX controller support

Post by TempUser_ »

Default key layout, nothing was changed there.

UPD2.
Atempt to explain this once again. + removed savetate

00:03 - Player is ABLE to run backwards and face opposite direction
00:07 - Restart with gamepad (VIEW > A)
00:08 - Menu is there > user selects Replay option
00:08 - Player is UNABLE to run backwards and face opposite direction
00:15 - Restart with gamepad (VIEW > A)
00:16 - Menu is there > user selects Replay option
00:17 - Player is UNABLE to run backwards and face opposite direction
00:21 - Restart with gamepad (VIEW > A)
00:22 - Menu is there > user selects Replay option
00:23 - Player is UNABLE to run backwards and face opposite direction
00:25 - Restart with gamepad (VIEW > A)
00:26 - No menu shown, level still restarts
00:27 - Player is UNABLE to select running directions, runs only upwards. (other button I think still work)
00:39 - Restart with gamepad (VIEW > A)
00:40 - No menu shown, level still restarts
00:41 - Player is UNABLE to select running directions, runs only upwards.
00:49 - Restart using KEYBOARD keys
00:50 - Menu is there > user selects Replay option
00:51 - Player is UNABLE to run backwards and face opposite direction


UPD1.
Another option to reproduce it.
Start game.
Load level.
Press PAUSE (Menu button on pad)
Press EXIT (View button on pad)
Confirm EXIT with A.
In menu load state or restart level.
Press EXIT
Confirm EXIT with A.
= Level restarts* without menu being shown.
*I suspect that menu isn't disappearing, there is just additional automatic keypress where in menu first item is being selected.

ORIGINAL.
Game starts.
You navigate menu and start new level or load save state.
Everything works.
You press (Change View button on pad) and Exit prompt shows up.
You press A (here acts as enter as I understood)
Menu appears.
Or you restart level or load savestate, player gets into map again.
(only this time controls gets buggy - player runs only single direction)
You press (Change View) and Exit prompt shows up.
You press A.
But now you wont get into menu, you restart level (or load save state if presented)

Such behavior is solvable if you exit level by using keyboard.

I did tried to capture key-presses in video, but seems like only ESC and ENTER with this software is being captured when controls are made from gamepad.
https://youtu.be/tQMrr3bR0Uc
TempUser_
Mugger
Mugger
Posts: 16
Joined: 07 Aug 2017, 17:08

Re: Twin stick mod and FULL XBOX controller support

Post by TempUser_ »

If broken controls after restarting levels could be fixed, I would say this will be top notch already.
Even without mentioned fix, currently game is very playable with gamepad.

Only one suggestion I have, we need some button combination to show last mission briefing text, on keyboard it's F7 key.
Nutranz
Ped
Ped
Posts: 2
Joined: 24 Sep 2020, 07:58
GH nick: Nutranz

Re: Twin stick mod and FULL XBOX controller support

Post by Nutranz »

First off, thank you for creating this mod. I never had so much fun with this Game. It feels like it was made by the developers themselves.
I just registered here to say this and also to give some feedback.
Btw. i can reproduce the error what TempUser described.
Launch Game, Go to a Map, Exit from the Map, Go to a Map again, Exit from the Map, Go to the Map once again, and then this strange Movement behavior happens.

But since yesterday i noticed another bug.
I started playing the Game 2 days ago. I began with "Town 1", played a few missions, saved in the Church, and exited the Game. Yesterday i resumed it, played again a few more Missions, finished "Town 1", and went straightforward to "Town 2". There i also played some Missions, saved at the Church, and exited the Game. Today i wanted to resume it, only to noticed that the Controller isn´t working at all for some reason. Not a single Button is working. Except... in the Main Menu. There it´s working. I tried all kinds of different things so the Controller would work again, but nothing helped.
But again, it´s clearly working in the Main Menu.
The other thing is i don´t even know what caused this. As i explained before when i played in "Town 1", saving, exiting and resuming the Game had no problems at all. So why does the Controller not work this time?

Edit1:
It seems after restarting my PC, the Controller get´s recognized again and it working. okay.....

Edit2:
Alright, so it seems after restarting my PC yesterday and resuming to play, it suddenly refuses to work once again??? I didn´t anything to the files or other stuff.

Edit3:
Yeah, today i once again tried it out, and what do you guess? Yesterday as i told the Controller wasn´t working, and today it´s working again.
So i guess when i shut down my PC today and will resume the Game tomorrow, does this mean the Controller will also refuse to work again?

Edit4:
It happened now even without restarting the PC. I just restarted the Game and the Controller doesn´t work again. I have no clue at this point anymore. I´m not sure what is doing this.
Last edited by Nutranz on 24 Sep 2020, 12:05, edited 1 time in total.
TempUser_
Mugger
Mugger
Posts: 16
Joined: 07 Aug 2017, 17:08

Re: Twin stick mod and FULL XBOX controller support

Post by TempUser_ »

Nutranz, I think you are referencing to problem when mod gets not loaded in/or loaded in incorrectly.
I suspect it's MISI "global" problem, if you check that topic or help file of mod, it says - if mod does not load in, just restart game.
Nutranz
Ped
Ped
Posts: 2
Joined: 24 Sep 2020, 07:58
GH nick: Nutranz

Re: Twin stick mod and FULL XBOX controller support

Post by Nutranz »

Well, i wouldn´t put this long text before if "Restarting the Game" would be the only solution.
Logofero
Serial Killer
Serial Killer
Posts: 264
Joined: 09 Dec 2015, 14:18
Location: Russia, Gelendzhik
Contact:

Re: Twin stick mod and FULL XBOX controller support

Post by Logofero »

If the script does not work in a certain state of the game (for example, after loading a save), then the condition in the script has not been fulfilled, then the calculations in the body of the loop are not performed.

Therefore, some calculations of the state of the buttons do not occur, that is, the script is not loaded or has been unloaded. For example, there is a break in the script loop, or the check is performed outside the range of getting the state of the IsGameKeyPress(), or the check of the game state is not performed correctly, so the script is not loaded. To fix the problem with non-working buttons, you need to find out what happens when the save is loaded, check that this condition is met, and after that, intercept the keys. Then the gamepad will always work.

Important: The state of the game must be checked in the script in order to read and write data to the game. If the script is executed in a loop (while true [your code] end), before executing the loop, you need to check that the game is loaded so that the game does not crash due to the fact that you are trying to read or write the data of a character whose game has not initialized. Therefore, it is important to check the state of the game before computation.

If even after checking all the conditions, the script does not load: check MISI.log (it is located in the root folder with the game), note that MISI has been loaded successfully and your script is loaded too (otherwise your scripts won't work). This can happen when it crashes, and if the library has not determined that the game has started, then it will not load along with it.

I have not tested the Dege's script, the mod author should know more about its shortcomings. But I can say about MISI, after loading the game, I also had strange phenomena. But since I always started with a new game, they did not interfere with my work and, in general, my scripts loaded stably (without having to restart the game).

Therefore, I did not perform enough tests while continuing the game to identify a possible script loading problem.

Determining and setting unexplored game states at the moment: starting a new game, loading, resume (pause), restarting (inside) the game, can help eliminate this problem and optimize the script for the necessary checks to make it work properly.

Added:
Please, attach a log file with an error, so the mod's author can quickly identify it. See this log at the root of the GTA2.

Added2:
You can also try the following: After checking the "pause on and off" state, you can try to re-read the character's data by func GetPedStruct() (since at this moment the memory addresses may change - this may be the main reason for the movement or button interception not to work). If it helps, please let everyone know.

Last updated: Added and corrected post.
User avatar
AssainGuy
Hitman
Hitman
Posts: 101
Joined: 01 Feb 2012, 13:11
GH nick: AssainGuy
Location: Hungary
Contact:

Re: Twin stick mod and FULL XBOX controller support

Post by AssainGuy »

Wow! Impressive, cant wait to give this a spin
i come here sometimes
Software Development / Audio Engineering
TempUser_
Mugger
Mugger
Posts: 16
Joined: 07 Aug 2017, 17:08

Re: Twin stick mod and FULL XBOX controller support

Post by TempUser_ »

Bump on this.
When this minor issue (on restart backward running does not work) breaks script slightly. Can it be solved just by reloading script when players gets into game ? Or Mb its easier rather than tinkering with script logic.

UPD1.
2nd idea, is it possible to run some IDE, and attach debugger to real-time process, throw few breakpoints, or value watches and see how these are changing ? Probably easier will be use logging function to dump values from time to time.

UPD2.
Found out normal player rotation behavior restores once player visits car. Like if you re-load level, you lose backwards running function, you enter in car, and you are good to go again.
Last edited by TempUser_ on 14 Dec 2023, 21:17, edited 1 time in total.
TempUser_
Mugger
Mugger
Posts: 16
Joined: 07 Aug 2017, 17:08

Re: Twin stick mod and FULL XBOX controller support

Post by TempUser_ »

Firstly noticed that in MP this mod does not load correctly, because for some reason it works only if your player gets player ID 1.
Like if you join game, it wont work as it should. While mod contains code and supposed to detect ID from 1 to 4.

But all this is irrelevant because, once your game load additional DLLs like ASI Loader for Widescreen or MISI for this mod. Your game will be out of sync. So its impossible to play multiplayer with this mod enabled.
If someone managed to get it work there properly, please share. But doubt it will.
User avatar
Sektor
Boss
Boss
Posts: 1423
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: Twin stick mod and FULL XBOX controller support

Post by Sektor »

Multiplayer only sends key/button presses, so instant rotation isn't going to sync in multiplayer. You can sync rotation with a modified mis/scr if everyone has that file but then you have to modify every level.
TempUser_
Mugger
Mugger
Posts: 16
Joined: 07 Aug 2017, 17:08

Re: Twin stick mod and FULL XBOX controller support

Post by TempUser_ »

Sektor wrote: 28 Jan 2023, 23:56 Multiplayer only sends key/button presses, so instant rotation isn't going to sync in multiplayer. You can sync rotation with a modified mis/scr if everyone has that file but then you have to modify every level.
Definitely I wont be able to implement this, as this sounds quite complicated stuff. :)
TempUser_
Mugger
Mugger
Posts: 16
Joined: 07 Aug 2017, 17:08

Re: Twin stick mod and FULL XBOX controller support

Post by TempUser_ »

Years after I'm still enjoying playing game with this mod. Also after multiple attempts to fix broken secondary angle after going into menu, still no luck.

TLDR.
Overall behavior is like this:
By default player can control player with both sticks independently. Run into any direction, and rotate player at same time.
If after gameplay user enters menu, and go back to gameplay, running remains, but rotation no longer is available at same time.
(Rotation works when player is static)
But entering car resets certain parameters, and rotation functionality gets restored, even during gameplay.

Another piece.
When user is in car, and goes into menu, this problem does not occur. Rotation remains.

UPDATE. [jailfree]
As always thought, this should be few code line solution.
This is how mentioned problem can be fixed.
Find code line 260:

Code: Select all

local isInCar = ReadProcessMemory(0x5e20bc, 1) ~= 0
After that one, just add:

Code: Select all

was_in_car = true
Code should look like this.
Image

Didn't tested this much, but no issues so far.
Post Reply