pgaskin / lithiumpatch

Adds additional functionality to the Lithium EPUB Reader Android app.
MIT License
44 stars 2 forks source link

Error when patching on Windows #4

Open HermitOwO opened 3 months ago

HermitOwO commented 3 months ago
error: apply patch "coversize": apply patch "coversize": inst 2: patch "smali/com/faultexception/reader/BooksFragment.smali": patcher 0: could not find "\n    .line 167\n    invoke-virtual {v2, v3}, Landroid/content/res/Resources;->getDimension(I)F\n\n    move-result v2\n\n    float-to-int v2, v2\n\n    add-int/2addr v2, p1\n\n    .line 166\n    invoke-virtual {v0, v2}, Lcom/faultexception/reader/widget/AutoFitRecyclerView;->setSpanWidth(I)V\n"
pgaskin commented 3 months ago

Are you sure you're using the exact same version of Lithium?

HermitOwO commented 3 months ago

Yes, I'm using Lithium 0.24.5.

gozilla-paradise commented 1 month ago

Got the same error as well

image

gozilla-paradise commented 1 month ago

Seems to fix the issue, it is due to windows reading smali will have \r\n while the patch only search for \n. To temporary fix the issue just change line 152 of patch.go with the following.

image

@HermitOwO

pgaskin commented 1 month ago

Thanks for tracking that down. I'll make a fix for that.

On a side note, at some point, I'll get around to replacing the text-based smali patching with proper semantic pattern matching on the instructions themselves.