Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*********************************************
- * GInput CLEO Extension
- * Tactile Cheat Activation
- * written by Deji
- * http://gtag.gtagaming.com
- * Compile with SCRambl (v1.0.41 or later)
- *********************************************/
- #pushcfg "CaseConversion" "NONE"
- #register_var 0x8 VAR_INT player
- #register_var 0xC VAR_INT scplayer
- #define FUNC_AddToCheatString 0x438480
- #define FUNC_GetModuleHandle 0x81E406
- #define REF_CheatHashes 0x438513
- // Compile with this set to 1 to enable a list of buttons in the cheat string
- #define SHOW_INPUT 0
- #if SHOW_INPUT
- #define FUNC_strlen 0x826330
- #define MEM_CheatString 0x969110
- #endif
- /*
- // lecture
- Scripts are run before the game fully starts to do set-ups like in the 'INIT' missions
- or continue to the beginning of a loop in a saved script) until the first WAIT
- So its a good idea to always WAIT, unless we really need that
- */
- WAIT 0
- {
- LVAR_INT pCheatTable pTranslation pButtons hGInput GInput_GetSourceButtonInput
- GET_LABEL_POINTER (cheats) pCheatTable
- GET_LABEL_POINTER (buttons) pButtons
- GET_LABEL_POINTER (translation) pTranslation
- // Get the module handle for GInput.asi
- CALL_FUNCTION_RETURN (FUNC_GetModuleHandle, 1, 0, STRING:"GInput.asi") hGInput
- // If not found, wait to warn the user
- IF hGInput = 0
- WHILE NOT IS_PLAYER_PLAYING (player)
- OR NOT IS_PLAYER_CONTROL_ON (player)
- OR IS_HELP_MESSAGE_BEING_DISPLAYED
- WAIT 0
- ENDWHILE
- PRINT_HELP_STRING "Tactile Cheat Activation~n~~r~Error: GInput.asi not found!"
- TERMINATE_THIS_CUSTOM_SCRIPT
- ENDIF
- // Get the only func we need and save it
- GET_DYNAMIC_LIBRARY_PROCEDURE ("_GInput_GetSourceButtonInput@8", hGInput) GInput_GetSourceButtonInput
- main:
- WAIT 0
- IF IS_PLAYER_PLAYING (player)
- LVAR_INT counter pAddr button temp_val1 temp_val2
- // Check for button presses
- REPEAT 14 counter
- button = counter + LEFTSHOULDER1
- IF NOT button == START
- AND NOT button == SELECT
- // Will return the exact input of a specific button, disregarding situational mapping
- CALL_FUNCTION_RETURN (GInput_GetSourceButtonInput, 2, 0, button, player) temp_val1
- // Get the address of the "pressed buttons" array, read the current value, write the new one
- pAddr = pButtons + counter
- READ_MEMORY (pAddr, 1, FALSE) temp_val2
- WRITE_MEMORY (pAddr, 1, temp_val1, FALSE)
- // If it wasn't already in the "pressed buttons" array, add it to the cheat string
- IF NOT temp_val1 = 0
- AND temp_val2 = 0
- // Find the appropriate ASCII character for this button so it can be hashed
- pAddr = pTranslation + counter
- READ_MEMORY (pAddr, 1, FALSE) temp_val2
- // Temporarily replace the cheat hashes array - the cheats will be only usable directly through this script
- READ_MEMORY (REF_CheatHashes, 4, TRUE) temp_val1
- WRITE_MEMORY (REF_CheatHashes, 4, pCheatTable, TRUE)
- // Pass to the func which handles PC cheats - it'll take care of everything (R* used the same method)
- CALL_FUNCTION (FUNC_AddToCheatString, 1, 1, temp_val2)
- // Restore the cheat hashes so PC cheats can be entered, other scripts can also have custom cheats, etc.
- WRITE_MEMORY (REF_CheatHashes, 4, temp_val1, TRUE)
- ENDIF
- ENDIF
- ENDREPEAT
- #if SHOW_INPUT
- // For, like, taking a video of this script and showing how the cheats are being entered...
- LVAR_INT len pCheatText pCheatEnd
- // Get the cheat string length and continue if we have anything to print
- CALL_FUNCTION_RETURN (FUNC_strlen, 1, 1, MEM_CheatString) len
- IF len > 0
- GET_LABEL_POINTER (cheat_text) pCheatText
- // Only show the last 16 buttons
- IF len > 16
- len = 16
- ENDIF
- // The cheat string is in reverse, so start from the end...
- pCheatEnd = MEM_CheatString + len
- WHILE pCheatEnd > MEM_CheatString
- --pCheatEnd
- --len
- // [space]
- WRITE_MEMORY (pCheatText, 1, 0x20, FALSE)
- ++pCheatText
- // Read the next/last char
- READ_MEMORY (pCheatEnd, 1, FALSE) temp_val1
- // Convert the cheat string char to a GXT symbol - which GInput will convert to a texture
- IF NOT temp_val1 == 0x31 // 1
- IF NOT temp_val1 == 0x32 // 2
- IF NOT temp_val1 == 0x33 // 3
- IF NOT temp_val1 == 0x34 // 4
- IF NOT temp_val1 == 0x55 // U(p)
- IF NOT temp_val1 == 0x44 // D(own)
- IF NOT temp_val1 == 0x4C // L(eft)
- IF NOT temp_val1 == 0x52 // R(ight)
- IF NOT temp_val1 == 0x53 // S(quare)
- IF NOT temp_val1 == 0x54 // T(riangle)
- IF NOT temp_val1 == 0x58 // X
- IF NOT temp_val1 == 0x43 // C(ircle)
- // it looks hideous...
- //WRITE_MEMORY (pCheatText, 1, temp_val1, FALSE)
- //++pCheatText
- --pCheatText
- GOTO showinput_continue
- ELSE
- temp_val2 = 0x6F // o
- ENDIF
- ELSE
- temp_val2 = 0x78 // x
- ENDIF
- ELSE
- temp_val2 = 0x74 // t
- ENDIF
- ELSE
- temp_val2 = 0x71 // q
- ENDIF
- ELSE
- temp_val2 = 0x3E // r
- ENDIF
- ELSE
- temp_val2 = 0x3C // l
- ENDIF
- ELSE
- temp_val2 = 0x64 // d
- ENDIF
- ELSE
- temp_val2 = 0x75 // u
- ENDIF
- ELSE
- temp_val2 = 0x76 // v
- ENDIF
- ELSE
- temp_val2 = 0x6A // j
- ENDIF
- ELSE
- temp_val2 = 0x6D // m
- ENDIF
- ELSE
- temp_val2 = 0x6B // k
- ENDIF
- // Concatenate the GXT symbol '~%c~' (where %c is the character we just got above, duh)
- WRITE_MEMORY (pCheatText, 1, 0x7E, FALSE)
- ++pCheatText
- WRITE_MEMORY (pCheatText, 1, temp_val2, FALSE)
- ++pCheatText
- WRITE_MEMORY (pCheatText, 1, 0x7E, FALSE)
- ++pCheatText
- showinput_continue:
- ENDWHILE
- // \0 at the end, standard...
- WRITE_MEMORY (pCheatText, 1, 0, FALSE)
- // Add the text label
- GET_LABEL_POINTER (cheat_text) pCheatText
- ADD_TEXT_LABEL ("_TAC", pCheatText)
- ELSE
- ADD_TEXT_LABEL ("_TAC", "")
- ENDIF
- // Print out the list
- USE_TEXT_COMMANDS TRUE
- SET_TEXT_SCALE (2.0, 2.0)
- SET_TEXT_SIZE 1.0
- DISPLAY_TEXT (8.0, 10.0, _TAC)
- #endif
- ENDIF
- GOTO main
- }
- #if SHOW_INPUT
- // if we're showing input, this gives us space to fit the GXT keys
- #hex
- cheat_text:
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // 32
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // 64
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // 96
- #endhex
- #endif
- // Space to store which buttons are currently held, so we dont repeatedly add it
- #hex
- buttons:
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // 16
- #endhex
- /*
- GTASA PS2 Cheat Hashes
- Recovered from the PS2 GTASA binary.
- Cheats are encrypted by reversing a string (so the input string doesn't need reversing every time)
- and calculating a CRC hash from it. The string is formatted depending on the buttons to press:
- X = Cross
- T = Triangle
- C = Circle
- S = Square
- U = Up
- D = Down
- L = Left
- R = Right
- 1 = L1
- 2 = L2
- 3 = R1
- 4 = R2
- e.g. for the weapon cheat (first in the hash table), hashing "URDLURDL4143" will produce 0x518BAD1E.
- GTASA was the first (and perhaps last) game in the series to use hashed cheats. This means that there
- are a huge number of possible combinations (over 200,000 confirmed) which can produce the same hash.
- */
- #hex
- cheats:
- 1EAD8B51 FB747986 05027580 A5E57B20 A49EF197 // 0
- E56ECF4D 1B17F6D8 30264DA4 021E33D2 292F88AE // 5
- 5402598F C91A176A 0DE5EDB4 A666C4CB E09B9F7F // 10
- 281603F0 0292842A 0D295494 EEEEA1E6 E47DBBE5 // 15
- 875C86B1 B76C60D9 1FF833B5 DDA2ECE3 817C02F8 // 20
- 2B4F181B 546C6509 B194B562 FBA8B3C9 5213EE53 // 25
- E116C1BA BFB3A08F 8A93579C 88F72076 98F427FD // 30
- 70BBE456 B5525F9A 0049BA49 196A8B20 4E854486 // 35
- 2013E451 94F19BE8 CF20CCC3 B78FC99B 773B9521 // 40
- BDB08091 A965D112 4E6D2E9C F498B87E 490D5A82 // 45
- 1CB73F10 B3FB6C9A 4D9A372A 57D0F8A6 33958F68 // 50
- 54E44076 599435C3 0DD6D4E1 63C154D3 9B456E4E // 55
- C60903ED 2D27C6F0 4FC21EC3 5FA8EFF3 E5310EB4 // 60
- CD041833 0C5FA944 F45180C5 07ECFFF5 AEF732CB // 65
- 2104BCF9 675C20F9 7C374CF2 B4736264 9A2CDF20 // 70
- 2053E2CD FC6C817F 45E3CFA3 31830183 E2865BF3 // 75
- 9EC12E53 9B1CC977 4E2B51E2 7A2D4EBC 1566F262 // 80
- D3576DF9 E11C79D5 333443EB 860376FA 11A7E1AC // 90
- 00000000 00000000 00000000 00000000 00000000 // 95
- #endhex
- #hex
- translation:
- // LEFTSHOULDER1-CIRCLE
- "1" "2" "3" "4" "U" "D" "L" "R" 00 00 "S" "T" "X" "C" 00
- #endhex
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement