diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2350c48 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +# Windows +Thumbs.db +ehthumbs.db +Desktop.ini diff --git a/adbreak/adbreak.html b/adbreak/adbreak.html index b50f8a5..cb54293 100644 --- a/adbreak/adbreak.html +++ b/adbreak/adbreak.html @@ -196,6 +196,10 @@ alert("Version number is: " + ver); var entry = offsets[ver]; +if (!entry) { + alert("This build is not in AdBreak's offset table: " + ver + "\nCheck firmware is 5.18.1-5.18.5 and that AdBreak supports your device."); + throw new Error("unsupported build"); +} var memcpy_got = entry.memcpy_got; var xml_got = entry.xml_got; var memcpy_offset = entry.memcpy_offset; diff --git a/adbreak/guide.txt b/adbreak/guide.txt index ca44015..529b0d4 100644 --- a/adbreak/guide.txt +++ b/adbreak/guide.txt @@ -29,7 +29,7 @@ Requirements: 7. Download and extract "adbreak.zip", copy the contents to the ".assets" folder on your desktop. 8. Replace the contents of all "details.html" files with the contents of "adbreak.html": - Windows: Double click on "replace.bat" + Windows: Double click on "replace.bat" (it searches from its own folder; you should see a list of each Replaced: path, or a message if none were found) Linux/Mac CLI: find . -name 'details.html' -exec cp adbreak.html {} \; 9. Delete the original .assets folder on the Kindle and replace it with our modified copy. diff --git a/adbreak/replace.bat b/adbreak/replace.bat index a884250..788eda6 100644 --- a/adbreak/replace.bat +++ b/adbreak/replace.bat @@ -1,8 +1,25 @@ @echo off -setlocal -for /r "." %%F in (details.html) do ( +setlocal EnableDelayedExpansion +rem Always search from this script's folder. "Run as administrator" and some +rem launch methods leave the current directory as System32, so for /r "." +rem would find nothing and fail silently. +set "_root=%~dp0" +set /a _count=0 +for /r "%_root%" %%F in (details.html) do ( if exist "%%~fF" ( - copy /y "%~dp0adbreak.html" "%%~fF" >nul + copy /y "%_root%adbreak.html" "%%~fF" >nul + if not errorlevel 1 ( + set /a _count+=1 + echo Replaced: %%~fF + ) ) ) +if !_count! equ 0 ( + echo No details.html files found under: + echo %_root% + echo Put replace.bat next to adbreak.html inside your copied .assets tree, then run again. +) else ( + echo. + echo Done. Replaced !_count! file^(s^). +) endlocal \ No newline at end of file