Raised This Month: $ Target: $400
 0% 

Solved [Q] Assembly code 'jump' | flags


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 02-05-2025 , 14:11   [Q] Assembly code 'jump' | flags
Reply With Quote #1

Hello. One question in my mind today.

I have tinkering code in server memory, I wanted change condition to else in one part.

Question is, like example
original code
Code:
76 39 - JNA xxxxx (Jump short if not above (CF=1 or ZF=1))
For example modified that to:
Code:
75 39 - JNZ xxxxx (Jump short if not zero (ZF=0))
https://faydoc.tripod.com/cpu/jna.htm

Do those 'flags' matter when editing code ? CF, ZF ?
Or can I ignore those ?

Last edited by Bacardi; 02-06-2025 at 11:54.
Bacardi is offline
Paimon
Senior Member
Join Date: Jul 2021
Location: Zootopia
Old 02-06-2025 , 00:16   Re: [Q] Assembly code 'jump' | flags
Reply With Quote #2

PHP Code:
cmp eax,ebx
jna
/jnz xxxxx 
jna means if eax is less or equal ebx, then jmp.
jnz means if eax is not equal ebx, then jmp.

You dont need to care about the flags, just logic is ok.
Just like if you want to jump when eax >= ebx, you should use jae.
__________________
Paimon is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 02-06-2025 , 10:30   Re: [Q] Assembly code 'jump' | flags
Reply With Quote #3

Thanks for info, about flags.

True, of that jump condition.

But I wanted to modify cs:s "join grace time", what is 20 seconds duration after round start.
Code:
// bool CCSGameRules::FPlayerCanRespawn( CBasePlayer *pBasePlayer )

// if ( gpGlobals->curtime > (m_fRoundStartTime + 20) )    // This condition need fail

"IDA"
F3 0F 10 8F 50 02 00 00       movss   xmm1, dword ptr [edi+250h]
A1 A0 B2 50 10                mov     eax, globals_dword_1050B2A0
F3 0F 58 0D 14 79 39 10       addss   xmm1, ds:flt_10397914 ; 20.00
F3 0F 10 40 0C                movss   xmm0, dword ptr [eax+0Ch]
0F 2F C1                      comiss  xmm0, xmm1
76 39                         jbe     short loc_10264446


"CheatEngine"
server.dll+2643EE - F3 0F10 8F 50020000   - movss xmm1,[edi+00000250]
server.dll+2643F6 - A1 A0B21970           - mov eax,[server.dll+50B2A0] { (71530B20) }
server.dll+2643FB - F3 0F58 0D 14790270   - addss xmm1,[server.dll+397914] { (20.00) }
server.dll+264403 - F3 0F10 40 0C         - movss xmm0,[eax+0C]
server.dll+264408 - 0F2F C1               - comiss xmm0,xmm1
server.dll+26440B - 76 39                 - jna server.dll+264446 <<- This
So, I guess to change somehow like this.
Code:
// if ( gpGlobals->curtime == (m_fRoundStartTime + 20) )

75 39                         jnz     short loc_10264446   // this 75 however works
- Now, player can't respawn during game in that exactly time.


---
Before this jump modification, I changed float value 20.00 to higher number, wierd things started happen on bots.
After long time figuring out what could cause it, I realize that float value "20.00" is constant, and this very same value is used in many places in game code, not only in this "join grace time" part.

Quote:
Originally Posted by Paimon View Post
PHP Code:
cmp eax,ebx
jna
/jnz xxxxx 
jna means if eax is less or equal ebx, then jmp.
jnz means if eax is not equal ebx, then jmp.

You dont need to care about the flags, just logic is ok.
Just like if you want to jump when eax >= ebx, you should use jae.
__________________
Do not Private Message @me

Last edited by Bacardi; 02-06-2025 at 10:45.
Bacardi is offline
Austin
Senior Member
Join Date: Oct 2005
Old 02-06-2025 , 14:24   Re: [Q] Assembly code 'jump' | flags
Reply With Quote #4

This looks like it is related to something I always wondered about.

mp_join_grace_time 240 // amount of time (in seconds) that a player can join the game for after a round starts. If they join after this period, they will be added to the spectators until the next round

This doesn't work even in CS2 For Values > 20 seconds!

So
1) mp_join_grace_time 0
bots or humans added after round start do not enter round alive.

2) mp_join_grace_time <= 20 seconds
bots or humans added after round start enter round alive
IF they enter in 20 seconds or less.
bots or humans added after this enter dead (or spec whatever)

3) mp_join_grace_time > 20
It's ignored!
It is as if it was set to 20.

Bacardi! I want this for CS2!
Go Go Go!
Austin is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 02-06-2025 , 15:01   Re: [Q] Assembly code 'jump' | flags
Reply With Quote #5

Proparly max bound set to 20.
In CS:GO max value is 30
Code:
"mp_join_grace_time" = "0.0" min. 0.000000 max. 30.000000
FCVAR_GAMEDLL FCVAR_REPLICATED FCVAR_RELEASE 
- Number of seconds after round start to allow a player to join a game
I don't know how work with cs2 (no sourcemod)
Quote:
Originally Posted by Austin View Post
This looks like it is related to something I always wondered about.

mp_join_grace_time 240 // amount of time (in seconds) that a player can join the game for after a round starts. If they join after this period, they will be added to the spectators until the next round

This doesn't work even in CS2 For Values > 20 seconds!

So
1) mp_join_grace_time 0
bots or humans added after round start do not enter round alive.

2) mp_join_grace_time <= 20 seconds
bots or humans added after round start enter round alive
IF they enter in 20 seconds or less.
bots or humans added after this enter dead (or spec whatever)

3) mp_join_grace_time > 20
It's ignored!
It is as if it was set to 20.

Bacardi! I want this for CS2!
Go Go Go!
__________________
Do not Private Message @me
Bacardi is offline
Austin
Senior Member
Join Date: Oct 2005
Old 02-06-2025 , 15:22   Re: [Q] Assembly code 'jump' | flags
Reply With Quote #6

Well in cs2 it Says 30,
but since when have the docs matched reality?

find mp_join_grace_time
name value default flags help text
__________________ ______ ________ ________________ _____________________________________________ _______________________
mp_join_grace_time 30 0 game replicated Number of seconds after round start to allow a player to join a game

Just to be sure I was remembering this correctly I tested it and yes it is 20 seconds for cs2 (at least).
Attached Thumbnails
Click image for larger version

Name:	!1.jpg
Views:	33
Size:	15.1 KB
ID:	207615  
Austin is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:28.


Powered by vBulletin®
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Theme made by Freecode