Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!   (84,812 visits to this link)

    2. News

    1. GTA Online

      1. Find Lobbies & Players
      2. Guides & Strategies
      3. Vehicles
      4. Content Creator
      5. Help & Support
    2. Crews

      1. Events
      2. Recruitment
    1. Grand Theft Auto Series

    2. GTA Next

    3. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    4. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA Mods
    5. GTA Chinatown Wars

    6. GTA Vice City Stories

    7. GTA Liberty City Stories

    8. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    9. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    10. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    11. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    12. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    3. Featured Mods

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption 2

    2. Red Dead Redemption

    3. Rockstar Games

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Programming
      5. Movies & TV
      6. Music
      7. Sports
      8. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Forum Support

    2. Site Suggestions

Y_Less

New keypresses

Recommended Posts

Y_Less

This uses methods in this topic and addresses found by my (available in the memory address topic) to work. Vice City stores the last 30 characters pressed in an array in memory, once I found this the rest was easy(ish).

 

 

:newkeypresses      03A4: name_thread "keys"\\ Uses memory addresses A10942 - A10960 found by me - 30 byte array of last 30 characters pressed.\\ First we need to set up CyQ's ASM to do the reading:0004: 8288?? = -1995422835&&0004: 8292?? = 1342335705&&0004: 8296?? = -1025694744&&0004: 8300?? = 1949868543&&0004: 8304?? = 495648893&&0004: 8308?? = 8221756&&0004: 8312?? = -1070589815&&0004: 8316?? = 10011777&&0004: 8320?? = 1599930368&&0004: 8324?? = 79846238&&0004: 8328?? = 272862464&&0004: 8332?? = 23779721&&0004: 8336?? = -587536304&&0004: 8340?? = 950140866&&0004: 8344?? = -1962902156&&0004: 8348?? = 1949868800&&0004: 8352?? = 1133314173&&0004: 8356?? = 1792641296&&0004: 8360?? = 568872961&&0004: 8364?? = 822067931&&0004: 8368?? = -1731952192&&0004: 8372?? = 1560281088&&0004: 8376?? = -1034199457&&0004: 8380?? = 4&&     \\ Now set the OpCode pointers.03FD: set_player -5035& handling_responsiveness  8532704&&0124: write_mem_address  6850752&& value  8532745&&\\ Up to here sets up the memory reading code0125: read_mem_address  10553666&& into $key008B: [email protected] =  1292??\\ Then we read in a variable\\ Each key is 1 byte but we read 4:newkeypressloop0001: wait 100? ms0125: read_mem_address  10553666&& into $key00D6: if 0?803c:   NOT $key == [email protected] 004D: jump if false ££newkeypressloop:newkeypress008B: [email protected] =  $key\\ We need to strip the excess bytes but also preserve the data, we want the most recent key, so we need to remove the 3 higher bytes:0016: [email protected] /= 16777216&&0012: [email protected] *= 16777216&&008B: [email protected] =  $key0062: [email protected] -= [email protected]\\ Now [email protected] contains just the first byte which we can test.\\ Check it's the right code or jump to the next cheat.00D6: if 0?0039:   [email protected] == 65? 004D: jump if false ££newkeypressloop\\ If the last key pressed was 'A' this will be true.\\ Do whatever you want here0002: jump ££newkeypressloop

 

 

If you want more keys to be pressed (e.g. to enter a cheat) you will need to test for larger numbers.

Share this post


Link to post
Share on other sites
Demarest

And since this is for VC, the LC team can finally have authentic cheats. IF there's enough room to acomodate all that code.

 

Does it have to be one key at a time? Or can you check to see if GESUNDHEIT was the last X keys pressed? And if you can, do you have to use bit coding to strip apart a DWORD to test individual bytes?

 

BTW, your best contribution yet! I wish we could crack SCM-based mem-hacking for GTA3 and SA.

Share this post


Link to post
Share on other sites
Y_Less

Just wait till you see what I've been working on the last day for this! The answer to about all your questions is YES (except the 3/SA part, not even looked into that yet, but we'll see) (and the bitcoding part, you CAN do it that way but I've a better way).

Share this post


Link to post
Share on other sites
Seemann

Same method is available for San Andreas.

 

MA 0x969110 is the start of an array that keeps 30 last pressed keys in SA.

So, accessing to this address allows to create new keypress checks and even create new cheats/passwords in run-time.

 

Using this I've got simple integer value for an array index that points at this address: -229908.

 

Though,

 

 [email protected] = -229908008B: [email protected] = &0([email protected],1i)

 

stores last 4 chars to [email protected]

 

I've written different variants how to check out one, two, three, four, five last chars and even 16 ones.

 

 

// custom keypresses, v. SA // EXAMPLE 1: TEST 1 key press (space)[email protected] = -229908while true 008B: [email protected] = &0([email protected],1i)  // get last keypresses 0085: [email protected] = [email protected]          div([email protected], 256)          // 1char 256, 2chars: 65536: 3chars: 16777216 mul([email protected], 256)          // same 0062: [email protected] -= [email protected]        // get needed number of chars (1)  if   [email protected] == 32 //0x20     // test if it's SPACE then      03E5: text_box 'CHEAT1'  // Cheat activated    Break end wait 1000 end // EXAMPLE 2: TEST 2 keys ('NO')[email protected] = -229908while true 008B: [email protected] = &0([email protected],1i)  // get last keypresses 0085: [email protected] = [email protected]          div([email protected], 65536)        // 1char 256, 2chars: 65536: 3chars: 16777216 mul([email protected], 65536)        // same 0062: [email protected] -= [email protected]        // get needed number of chars (2) if   [email protected] == 20047 //0x4e4f        // test if player typed NO then      03E5: text_box 'CHEAT1'  // Cheat activated   Break end wait 1000 end // EXAMPLE 3: TEST 3 keys ('WOW')[email protected] = -229908while true 008B: [email protected] = &0([email protected],1i)     // get last keypresses 0085: [email protected] = [email protected]          div([email protected], 16777216)        // 1char 256, 2chars: 65536: 3chars: 16777216 mul([email protected], 16777216)        // same 0062: [email protected] -= [email protected]           // get needed number of chars  (3) if   [email protected] == 5721943 //0x574f57         // test if player typed WOW then     03E5: text_box 'CHEAT1'  // Cheat activated   Break end wait 1000 end // EXAMPLE 4: TEST 4 keys ('HACK')[email protected] = -229908while true if   &0([email protected],1i) == 1212236619 //0x4841434B  // test if player typed HACK then   03E5: text_box 'CHEAT1'  // Cheat activated   Break end wait 1000 end// EXAMPLE 5: TEST 5 keys ('SANNY')// test 5th char 's' from address +4b, then test 'anny' from the beginning;//  addr      keys// -229908: X X X X    |  -229908: A N N Y// -229907: X X X O 

 

 

Edit:

Just realised that the code I posted works only for me (with newest version of SB), because SB v2.99 doesn't support hex numbers in a math expression. So, I converted these numbers to decimal format in order the code can be compiled.

Edited by Seemann

Share this post


Link to post
Share on other sites
Seemann

You can check if ANY key is pressed via the mission scripts.

 

1. Open the keyslist

http://sannybuilder.com/dev/keycodes.htm

Find the key you need to check.

 

2. First column contains the index pointing to the key related memory address. Using the array's method of reading the memory you can get the current state of the key.

 

3. The keys located at the column KeyLo returns 0xFF when pressed. The keys located at the column KeyHi returns 0xFF0000 when pressed.

 

4. Read the mem addy using index and compare the value with the conforming constant.

 

 

Example1. Check ENTER

 

[email protected] = 304490 // Enter's index:loopwait 0&0([email protected],1i) == 0x00FF0000 // KeyHijf @loopplayer.money($player_char) += 100 // Enter pressed!

 

 

 

Example2. Check TILDE (~)

 

[email protected] = 304550 // Tilde's index:loopwait 0&0([email protected],1i) == 0xFF // KeyLojf @loopplayer.money($player_char) += 100 // Tilde pressed!

 

 

Example3. Combined checks: Num1+ Num2

 

[email protected] = 304484 // Num1,Num2 index:loopwait 0&0([email protected],1i) == 0x00FF00FF // Num1+Num2jf @loopplayer.money($player_char) += 100 // Whoa! Num1+Num2 pressed!

 

 

 

 

All indexes are for version 1.0

Share this post


Link to post
Share on other sites
DIMICH

How to use this in VC? blush.gif

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.