Smali change iget-wide to const value

303 Views Asked by At

I have this code (original):

.method public final component1()J
.registers 3

iget-wide v0, p0, Lio/wondrous/sns/data/model/levels/UserLevel;->totalPoints:J

return-wide v0
.end method

I need to return static value, like:

const v0, 500000

but it construction doesnt work. Any ideas? Thanks!

1

There are 1 best solutions below

0
Serella On

It should be

const-wide v0 , 0x500000

Or if the 500000 is the decimal then you have to convert it into hex which is 7A120. Then use this:

const-wide v0, 0x7A120

The final code will look like:

.method public final component1()J
.registers 3

iget-wide v0, p0, Lio/wondrous/sns/data/model/levels/UserLevel;->totalPoints:J

const-wide v0, 0x7A120
.end method