Skip to content

Commit

Permalink
DVDPlayer additional files installation (#24)
Browse files Browse the repository at this point in the history
* add dvdplayer extra file install

* skip dvdplayer file override

* Update dvdplayer prompt lang
  • Loading branch information
israpps authored Jun 6, 2024
1 parent 6ced628 commit 6e743ee
Show file tree
Hide file tree
Showing 8 changed files with 200 additions and 170 deletions.
15 changes: 14 additions & 1 deletion bin/INSTALL/EXTINST.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ HDD_INST_TABLE = {
},
}

DVDPL_INST_TABLE = {
source = {}, --- holds file locations relative to KELFBinder CWD.
target = {}, --- contains installation paths ignoring device (eg: instead of `mc0:/A/BOOT.ELF` use `A/BOOT.ELF`)
dirs = {} --- contains a list of directory names to be created before writing files to target
}

---parse directory and append paths based on files found inside `SOURCEDIR` into `SOURCE_TABLE` and `DEST_TABLE`.
---if at least 1 file is found, the value of `DESTNTDIR` is added into `MKDIR_TABLE`
---@param SOURCEDIR string
Expand Down Expand Up @@ -71,7 +77,9 @@ Update_InstTable("INSTALL/ASSETS/PS2BBL-HDD", "hdd0:__sysconf:pfs:/PS2BBL", HDD_
Update_InstTable("INSTALL/ASSETS/APPS-HDD" , "hdd0:__common:pfs:/APPS" , HDD_INST_TABLE.source, HDD_INST_TABLE.target, HDD_INST_TABLE.dirs)
Update_InstTable("INSTALL/ASSETS/BOOT-HDD" , "hdd0:__sysconf:pfs:/BOOT" , HDD_INST_TABLE.source, HDD_INST_TABLE.target, HDD_INST_TABLE.dirs)

Update_InstTable("INSTALL/ASSETS/FSCK" , "hdd0:__system:pfs:/fsck/lang" , HDD_INST_TABLE.source, HDD_INST_TABLE.target, HDD_INST_TABLE.dirs)
Update_InstTable("INSTALL/ASSETS/FSCK", "hdd0:__system:pfs:/fsck/lang", HDD_INST_TABLE.source, HDD_INST_TABLE.target, HDD_INST_TABLE.dirs)

Update_InstTable("INSTALL/ASSETS/DVDPLAYER_FILES", "", DVDPL_INST_TABLE.source, DVDPL_INST_TABLE.target, DVDPL_INST_TABLE.dirs)

System.log("MC installation table:\n")
for x = 1, #MC_INST_TABLE.source do
Expand All @@ -81,4 +89,9 @@ end
System.log("HDD installation table:\n")
for x = 1, #HDD_INST_TABLE.source do
System.log(string.format("\t[%s] > [%s]\n", HDD_INST_TABLE.source[x], HDD_INST_TABLE.target[x]))
end

System.log("DVDPlayer installation table:\n")
for x = 1, #DVDPL_INST_TABLE.source do
System.log(string.format("\t[%s] > [%s]\n", DVDPL_INST_TABLE.source[x], DVDPL_INST_TABLE.target[x]))
end
75 changes: 43 additions & 32 deletions bin/INSTALL/KELFBinder.lua
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,24 @@ function PreExtraAssetsInstall(FILECOUNT, FOLDERCOUNT, SIZECOUNT)

return FILECOUNT, FOLDERCOUNT, SIZECOUNT
end

function InstallDVDPlayerAssets(port, cur, total, dvdfolder)
ReportProgress(cur, total, "", LNG_INSTALLING_DVDPL)
local ret = 0
if #DVDPL_INST_TABLE.source > 0 and MUST_INSTALL_EXTRA_FILES then
for i = 1, #DVDPL_INST_TABLE.source do
if DVDPL_INST_TABLE.target[i] == "/dvdplayer.elf" then goto skipfile end
ReportProgress(cur+i, total, dvdfolder..DVDPL_INST_TABLE.target[i], LNG_INSTALLING_EXTRA)
if doesFileExist(DVDPL_INST_TABLE.source[i]) then -- CHECK FOR EXISTENCE, OTHERWISE, PROGRAM CRASHES!
ret = System.copyFile(DVDPL_INST_TABLE.source[i], string.format("mc%d:/%s%s", port, dvdfolder, DVDPL_INST_TABLE.target[i]))
if ret < 0 then return ret end
end
::skipfile::
end
end
return 1
end

function InstallExtraAssets(port, cur, total)
ReportProgress(cur, total)
local ret = 0
Expand Down Expand Up @@ -639,18 +657,18 @@ function DVDPlayerINST(port, slot, target_region)
local RET
local TARGET_FOLD = KELFBinder.getDVDPlayerFolder(target_region)
local TARGET_KELF = string.format("mc%d:/%s/dvdplayer.elf", port, TARGET_FOLD)

local tinst = #DVDPL_INST_TABLE.target+2
if doesFileExist(DVDPLAYERUPDATE) then
System.AllowPowerOffButton(0)
Screen.clear()
Graphics.drawScaleImage(BG, 0.0, 0.0, SCR_X, SCR_Y)
Font.ftPrint(LSANS, X_MID, 20, 8, 600, 64, string.format(LNG_INSTPMPT, TARGET_KELF))
Screen.flip()
ReportProgress(0, tinst, (LNG_INSTPMPT):format(TARGET_KELF), LNG_INSTALLING_DVDPL)
System.createDirectory(string.format("mc%d:/%s", port, TARGET_FOLD))
KELFBinder.setSysUpdateFoldProps(port, slot, TARGET_FOLD)
RET = Secrman.downloadfile(port, slot, DVDPLAYERUPDATE, TARGET_KELF)
System.AllowPowerOffButton(1)
if RET < 0 then Secrerr(RET) return end
RET = InstallDVDPlayerAssets(port, 1, tinst, TARGET_FOLD)
if RET < 0 then Secrerr(RET) return end
ReportProgress(tinst, tinst, "", LNG_INSTALLING_DVDPL)
System.AllowPowerOffButton(1)
Secrerr(RET)
else
Secrerr(-203)
Expand Down Expand Up @@ -741,14 +759,7 @@ function NormalInstall(port, slot)
ReportProgress(5, tot)
RET = InstallExtraAssets(port, 5, tot)
System.AllowPowerOffButton(1)
local Z = 0x80
while Z > 0 do
Screen.clear()
Graphics.drawScaleImage(BG, 0.0, 0.0, SCR_X, SCR_Y)
DrawbarNbg(X_MID, Y_MID, 100, Color.new(0xff, 0xff, 0xff, Z))
Screen.flip()
Z = Z-2
end
ReportProgressFadeEnd()
Secrerr(RET)
end

Expand Down Expand Up @@ -1645,27 +1656,34 @@ function PerformExpertINST(port, slot, UPDT)
end

RET = InstallExtraAssets(port, cur, total)
System.AllowPowerOffButton(1) local Z = 0x80
while Z > 0 do
Screen.clear()
Graphics.drawScaleImage(BG, 0.0, 0.0, SCR_X, SCR_Y)
DrawbarNbg(X_MID, Y_MID, 100, Color.new(0xff, 0xff, 0xff, Z))
Screen.flip()
Z = Z-2
end
System.AllowPowerOffButton(1)
ReportProgressFadeEnd()
Secrerr(RET)
end

function ReportProgress(prog, total, EXTRASTR)
function ReportProgress(prog, total, EXTRASTR, MAINSTR)
Screen.clear()
Graphics.drawScaleImage(BG, 0.0, 0.0, SCR_X, SCR_Y)
Font.ftPrint(LSANS, X_MID, 40, 8, 600, 64, LNG_INSTALLING)
local a
if type(MAINSTR) == "string" then a = MAINSTR else a = LNG_INSTALLING end
Font.ftPrint(LSANS, X_MID, 40, 8, 600, 64, a)
if type(EXTRASTR) == "string" then Font.ftPrint(LSANS_SMALL, X_MID, 120, 8, 600, 64, EXTRASTR) end
DrawbarNbg(X_MID, Y_MID, 100, Color.new(0xff, 0xff, 0xff, 0x30))
DrawbarNbg(X_MID, Y_MID, ((prog * 100) / total), Color.new(0xff, 0xff, 0xff, 0x80))
Screen.flip()
end

function ReportProgressFadeEnd()
local Z = 0x80
while Z > 0 do
Screen.clear()
Graphics.drawScaleImage(BG, 0.0, 0.0, SCR_X, SCR_Y)
DrawbarNbg(X_MID, Y_MID, 100, Color.new(0xff, 0xff, 0xff, Z))
Screen.flip()
Z = Z-2
end
end

function WriteDataToHDD()
System.log("Starting file transfer to HDD\n")
Screen.clear()
Expand Down Expand Up @@ -1708,14 +1726,7 @@ function WriteDataToHDD()
end
end
HDD.UMountPartition(0)
local Z = 0x80
while Z > 0 do
Screen.clear()
Graphics.drawScaleImage(BG, 0.0, 0.0, SCR_X, SCR_Y)
DrawbarNbg(X_MID, Y_MID, 100, Color.new(0xff, 0xff, 0xff, Z))
Screen.flip()
Z = Z-2
end
ReportProgressFadeEnd()
return 1
end

Expand Down
1 change: 1 addition & 0 deletions bin/lang/italian.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ LNG_CONTINUE = "Avanti"
LNG_COMPAT0 = "Questo modello di console non supporta gli aggiornamenti di sistema."
LNG_COMPAT1 = "Puoi, tuttavia, utilizzarla per l'installazione."
LNG_PICK_DVDPLAYER_REG = "Scegli la regione di aggiornamento del Lettore DVD"
LNG_INSTALLING_DVDPL = "Installing DVDPlayer Update..."
LNG_JPN = "Giappone"
LNG_USA = "USA"
LNG_ASI = "Asia"
Expand Down
1 change: 1 addition & 0 deletions bin/lang/polish.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ LNG_CONTINUE = "Kontynuuj"
LNG_COMPAT0 = "Ten model konsoli nie obsługuje aktualizacji systemowych."
LNG_COMPAT1 = "Ale możesz go i tak użyć do instalacji aktualizacji."
LNG_PICK_DVDPLAYER_REG = "Wybierz region aktualizacji DVD Player'a"
LNG_INSTALLING_DVDPL = "Installing DVDPlayer Update..."
LNG_JAP = "Japonia"
LNG_USA = "USA"
LNG_USANASIA = "USA & Azja"
Expand Down
1 change: 1 addition & 0 deletions bin/lang/portuguese.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ LNG_CONTINUE = "Continar"
LNG_COMPAT0 = "Este console não suporta atualizações do sistema."
LNG_COMPAT1 = "Porém, você ainda pode usa-lo para instalar atualizações."
LNG_PICK_DVDPLAYER_REG = "Selecione a região da atualização do DVD Player's"
LNG_INSTALLING_DVDPL = "Instalando atualizações de DVDPlayer..."
LNG_JPN = "Japão"
LNG_USA = "USA"
LNG_ASI = "Asia"
Expand Down
Loading

0 comments on commit 6e743ee

Please sign in to comment.