[Galaxy S 4 i9505 Android Development] maanz "L":
Hello guys..

I want to share the Vertical Screen Off I mod for my I9505 (XXUBMF8) which you can find on most CM roms.

This should be able to apply on all other firmwares on the I9505 (not tested yet).

but first, you need:

1. smali/baksmali app/tools

2. Some knowledge about compiling and decompiling

3. 7zip/winrar/winzip

4. notepad++

Let's get started...

1. Decompile services.jar

go to com\android\server\power\ElectronBeam.smali using notepad++.

2. Find:

[COLOR="SeaGreen"].method private drawHStretch(F)V[/COLOR]

Inspect the following the codes and make edits:

[B].registers 9
.parameter "stretch"

.prologue
const v6, 0x8074

const/4 v5, 0x0

const/high16 v4, 0x3f80

.line 321
const/high16 v1, 0x4100

invoke-static {p1, v1}, Lcom/android/server/power/ElectronBeam;->scurve(FF)F

move-result v0

.line 326
.local v0, ag:F
cmpg-float v1, p1, v4

if-gez v1, :cond_37

.line 328
const/4 v1, 0x2

const/16 v2, 0x1406

iget-object v3, p0, Lcom/android/server/power/ElectronBeam;->mVertexBuffer:Ljava/nio/FloatBuffer;

invoke-static {v1, v2, v5, v3}, Landroid/opengl/GLES10;->glVertexPointer(IIILjava/nio/Buffer;)V

.line 329
invoke-static {v6}, Landroid/opengl/GLES10;->glEnableClientState(I)V

.line 332
iget-object v1, p0, Lcom/android/server/power/ElectronBeam;->mVertexBuffer:Ljava/nio/FloatBuffer;

iget v2, p0, Lcom/android/server/power/ElectronBeam;->mDisplayWidth:I

int-to-float v2, v2

iget v3, p0, Lcom/android/server/power/ElectronBeam;->mDisplayHeight:I

int-to-float v3, v3

invoke-static {v1, v2, v3, v0}, Lcom/android/server/power/ElectronBeam;->setHStretchQuad(Ljava/nio/FloatBuffer;FFF)V

.line 333
sub-float v1, v4, v0

sub-float v2, v4, v0

sub-float v3, v4, v0

invoke-static {v1, v2, v3, v4}, Landroid/opengl/GLES10;->glColor4f(FFFF)V

.line 334
const/4 v1, 0x6

const/4 v2, 0x4

invoke-static {v1, v5, v2}, Landroid/opengl/GLES10;->glDrawArrays(III)V

.line 337
invoke-static {v6}, Landroid/opengl/GLES10;->glDisableClientState(I)V

.line 339
:cond_37
return-void
.end method[/B]

3. Next, find:

[COLOR="SeaGreen"].method private drawVStretch(F)V[/COLOR]

Inspect the following codes and make edits:

[B].registers 13
.parameter "stretch"

.prologue
const/4 v10, 0x6

const/4 v9, 0x4

const/16 v8, 0xde1

const/4 v7, 0x1

const/4 v6, 0x0

.line 249
const/high16 v3, 0x40f0

invoke-static {p1, v3}, Lcom/android/server/power/ElectronBeam;->scurve(FF)F

move-result v2

.line 250
.local v2, ar:F
const/high16 v3, 0x4100

invoke-static {p1, v3}, Lcom/android/server/power/ElectronBeam;->scurve(FF)F

move-result v1

.line 251
.local v1, ag:F
const/high16 v3, 0x4108

invoke-static {p1, v3}, Lcom/android/server/power/ElectronBeam;->scurve(FF)F

move-result v0

.line 258
.local v0, ab:F
invoke-static {v7, v7}, Landroid/opengl/GLES10;->glBlendFunc(II)V

.line 259
const/16 v3, 0xbe2

invoke-static {v3}, Landroid/opengl/GLES10;->glEnable(I)V

.line 262
const/4 v3, 0x2

const/16 v4, 0x1406

iget-object v5, p0, Lcom/android/server/power/ElectronBeam;->mVertexBuffer:Ljava/nio/FloatBuffer;

invoke-static {v3, v4, v6, v5}, Landroid/opengl/GLES10;->glVertexPointer(IIILjava/nio/Buffer;)V

.line 263
const v3, 0x8074

invoke-static {v3}, Landroid/opengl/GLES10;->glEnableClientState(I)V

.line 266
iget-object v3, p0, Lcom/android/server/power/ElectronBeam;->mTexNames:[I

aget v3, v3, v6

invoke-static {v8, v3}, Landroid/opengl/GLES10;->glBindTexture(II)V

.line 267
const/16 v4, 0x2300

const/16 v5, 0x2200

iget v3, p0, Lcom/android/server/power/ElectronBeam;->mMode:I

if-nez v3, :cond_c8

const/16 v3, 0x2100

:goto_3f
invoke-static {v4, v5, v3}, Landroid/opengl/GLES10;->glTexEnvx(III)V

.line 269
const/16 v3, 0x2800

const/16 v4, 0x2601

invoke-static {v8, v3, v4}, Landroid/opengl/GLES10;->glTexParameterx(III)V

.line 271
const/16 v3, 0x2801

const/16 v4, 0x2601

invoke-static {v8, v3, v4}, Landroid/opengl/GLES10;->glTexParameterx(III)V

.line 273
const/16 v3, 0x2802

const v4, 0x812f

invoke-static {v8, v3, v4}, Landroid/opengl/GLES10;->glTexParameterx(III)V

.line 275
const/16 v3, 0x2803

const v4, 0x812f

invoke-static {v8, v3, v4}, Landroid/opengl/GLES10;->glTexParameterx(III)V

.line 277
invoke-static {v8}, Landroid/opengl/GLES10;->glEnable(I)V

.line 278
const/4 v3, 0x2

const/16 v4, 0x1406

iget-object v5, p0, Lcom/android/server/power/ElectronBeam;->mTexCoordBuffer:Ljava/nio/FloatBuffer;

invoke-static {v3, v4, v6, v5}, Landroid/opengl/GLES10;->glTexCoordPointer(IIILjava/nio/Buffer;)V

.line 279
const v3, 0x8078

invoke-static {v3}, Landroid/opengl/GLES10;->glEnableClientState(I)V

.line 282
iget-object v3, p0, Lcom/android/server/power/ElectronBeam;->mVertexBuffer:Ljava/nio/FloatBuffer;

iget v4, p0, Lcom/android/server/power/ElectronBeam;->mDisplayWidth:I

int-to-float v4, v4

iget v5, p0, Lcom/android/server/power/ElectronBeam;->mDisplayHeight:I

int-to-float v5, v5

invoke-static {v3, v4, v5, v2}, Lcom/android/server/power/ElectronBeam;->setVStretchQuad(Ljava/nio/FloatBuffer;FFF)V

.line 283
invoke-static {v7, v6, v6, v7}, Landroid/opengl/GLES10;->glColorMask(ZZZZ)V

.line 284
invoke-static {v10, v6, v9}, Landroid/opengl/GLES10;->glDrawArrays(III)V

.line 287
iget-object v3, p0, Lcom/android/server/power/ElectronBeam;->mVertexBuffer:Ljava/nio/FloatBuffer;

iget v4, p0, Lcom/android/server/power/ElectronBeam;->mDisplayWidth:I

int-to-float v4, v4

iget v5, p0, Lcom/android/server/power/ElectronBeam;->mDisplayHeight:I

int-to-float v5, v5

invoke-static {v3, v4, v5, v1}, Lcom/android/server/power/ElectronBeam;->setVStretchQuad(Ljava/nio/FloatBuffer;FFF)V

.line 288
invoke-static {v6, v7, v6, v7}, Landroid/opengl/GLES10;->glColorMask(ZZZZ)V

.line 289
invoke-static {v10, v6, v9}, Landroid/opengl/GLES10;->glDrawArrays(III)V

.line 292
iget-object v3, p0, Lcom/android/server/power/ElectronBeam;->mVertexBuffer:Ljava/nio/FloatBuffer;

iget v4, p0, Lcom/android/server/power/ElectronBeam;->mDisplayWidth:I

int-to-float v4, v4

iget v5, p0, Lcom/android/server/power/ElectronBeam;->mDisplayHeight:I

int-to-float v5, v5

invoke-static {v3, v4, v5, v0}, Lcom/android/server/power/ElectronBeam;->setVStretchQuad(Ljava/nio/FloatBuffer;FFF)V

.line 293
invoke-static {v6, v6, v7, v7}, Landroid/opengl/GLES10;->glColorMask(ZZZZ)V

.line 294
invoke-static {v10, v6, v9}, Landroid/opengl/GLES10;->glDrawArrays(III)V

.line 297
invoke-static {v8}, Landroid/opengl/GLES10;->glDisable(I)V

.line 298
const v3, 0x8078

invoke-static {v3}, Landroid/opengl/GLES10;->glDisableClientState(I)V

.line 299
invoke-static {v7, v7, v7, v7}, Landroid/opengl/GLES10;->glColorMask(ZZZZ)V

.line 302
iget v3, p0, Lcom/android/server/power/ElectronBeam;->mMode:I

if-ne v3, v7, :cond_bc

.line 303
const/high16 v3, 0x3f80

invoke-static {v1, v1, v1, v3}, Landroid/opengl/GLES10;->glColor4f(FFFF)V

.line 304
invoke-static {v10, v6, v9}, Landroid/opengl/GLES10;->glDrawArrays(III)V

.line 308
:cond_bc
const v3, 0x8074

invoke-static {v3}, Landroid/opengl/GLES10;->glDisableClientState(I)V

.line 309
const/16 v3, 0xbe2

invoke-static {v3}, Landroid/opengl/GLES10;->glDisable(I)V

.line 310
return-void

.line 267
:cond_c8
const/16 v3, 0x1e01

goto/16 :goto_3f
.end method[/B]

3. Find:

[COLOR="SeaGreen"].method private static setHStretchQuad(Ljava/nio/FloatBuffer;FFF)V[/COLOR]

Inspect and make edits:

[B].registers 11
.parameter "vtx"
.parameter "dw"
.parameter "dh"
.parameter "a"

.prologue
const/high16 v6, 0x3f80

const/high16 v5, 0x3f00

.line 350
const/high16 v0, 0x3f80

.line 351
.local v1, w:F
mul-float v4, p1, p3

add-float v0, p1, v4

.line 352
.local v0, h:F
sub-float v4, p1, v6

mul-float v2, v4, v5

.line 353
.local v2, x:F
sub-float v4, p2, v0

mul-float v3, v4, v5

.line 354
.local v3, y:F
invoke-static {p0, v2, v3, v6, v0}, Lcom/android/server/power/ElectronBeam;->setQuad(Ljava/nio/FloatBuffer;FFFF)V

.line 355
return-void
.end method[/B]

4. Lastly, find:

[COLOR="SeaGreen"]method private static setVStretchQuad(Ljava/nio/FloatBuffer;FFF)V[/COLOR]

Inspect and make edits:

[B].registers 10
.parameter "vtx"
.parameter "dw"
.parameter "dh"
.parameter "a"

.prologue
const/high16 v5, 0x3f00

.line 342
mul-float v4, p1, p3

sub-float v1, p1, v4

.line 343
.local v1, w:F
mul-float v4, p2, p3

add-float v0, p2, v4

.line 344
.local v0, h:F
sub-float v4, p1, v1

mul-float v2, v4, v5

.line 345
.local v2, x:F
sub-float v4, p2, v0

mul-float v3, v4, v5

.line 346
.local v3, y:F
invoke-static {p0, v2, v3, v1, v0}, Lcom/android/server/power/ElectronBeam;->setQuad(Ljava/nio/FloatBuffer;FFFF)V

.line 347
return-void
.end method[/B]

Thats it.

Compile back the services.jar and flash it.

This has been tested on my device.

For Dev cookers, you are allowed to use this mod in your project. Give proper credits and thanks.

**Special thanks to Adi Aisiteru Reborn for the cm10.1 informative guide.

Press the thanks button if this mod has made your day. ;)