Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

- Implemented progress bar display while processing PKG(s) file(s).

  • Loading branch information...
commit f7e527a48e2158a2083e6a17525fe31f62aded14 1 parent d8920ab
@CaptainCPS authored
View
6 Makefile
@@ -1,12 +1,12 @@
# -------------------------------------------------------------------
-# gamePKG Makefile [by CaptainCPS-X, 2012]
+# gamePKG Makefile [by CaptainCPS-X, 2012-2013]
# -------------------------------------------------------------------
-APP_VER =1.01A
+APP_VER =1.02
DATE =$(shell date +"%Y%m%d")
PSN_PKG_NPDRM = bin/psn_package_npdrm
-SELF_APP_VER =0001000100000000
+SELF_APP_VER =0001000200000000
CONTENT_ID =GP4PS3-GPKG00123_00-0000000000000000
MAKE_SELF_NPDRM = scetool.exe \
--sce-type=SELF \
View
10 README.md
@@ -66,7 +66,11 @@ Usage:
Changelog:
----------------------------------------------
-1.1A (20130109)
+1.02 (20130110)
+
+- Implemented progress bar display while processing PKG(s) file(s).
+
+1.01A (20130109)
- Re-wrote device and directory scanning code, now it is case-sensitive :)
- The following directories are valid for PKG file storage:
@@ -84,7 +88,7 @@ Changelog:
Note: You can have all those directories at same time, with different PKG files,
and they will be properly scanned, not even multiMAN have this implemented :p, LOL.
-1.1 (20130109)
+1.01 (20130109)
- Implemented PKG list sorting by filename.
- Added feature to remove previously queued PKG by pressing ([ ]) square.
@@ -95,7 +99,7 @@ and they will be properly scanned, not even multiMAN have this implemented :p, L
- Re-wrote module to write the PDB & Icon files from scratch.
- Other source code improvements.
-1.0 (20121220)
+1.00 (20121220)
- Initial "Test" Release
View
BIN  msvc/gamePKG/gamePKG.suo
Binary file not shown
View
BIN  release/PS3_GAME/USRDIR/EBOOT.BIN
Binary file not shown
View
93 src/gamePKG.cpp
@@ -32,11 +32,14 @@ Tested on:
- support re-scaning devices for new PKG files
WIP - verify HDD for previously queued files
- - display a Progress bar
- support split PKG files
*/
+// --------------------------------------------------------------------
+#define APP_TITLE " gamePKG Tool v1.02 - by CaptainCPS-X [2012-2013]"
+// --------------------------------------------------------------------
+
#include "main.h"
#include "misc.h"
#include "gamePKG.h"
@@ -90,7 +93,7 @@ void c_gamePKG::DisplayFrame()
::cellDbgFontPuts(xPos, yPos, nFontSize, 0xffffffff, "----------------------------------------------------------------------" );
yPos += yPosDiff;
- ::cellDbgFontPuts(xPos, yPos, nFontSize, 0xffffffff, " gamePKG Tool v1.1A - by CaptainCPS-X [2012-2013]");
+ ::cellDbgFontPuts(xPos, yPos, nFontSize, 0xffffffff, APP_TITLE);
yPos += yPosDiff;
::cellDbgFontPuts(xPos, yPos, nFontSize, 0xffffffff, "----------------------------------------------------------------------" );
yPos += yPosDiff;
@@ -308,7 +311,11 @@ void c_gamePKG::DlgDisplayFrame()
);
::cellMsgDialogOpen2(
- CELL_MSGDIALOG_BUTTON_TYPE_NONE | CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_ON,
+ CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL
+ |CELL_MSGDIALOG_TYPE_BUTTON_TYPE_NONE
+ |CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_ON
+ |CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NONE
+ |CELL_MSGDIALOG_TYPE_PROGRESSBAR_SINGLE,
szMsg,
DlgCallbackFunction, NULL, NULL
);
@@ -916,14 +923,25 @@ int c_gamePKG::CreatePDBFiles()
#define BUFF_SIZE 0x300000 // 3MB
+double _round(double r) {
+ return (r > 0.0) ? floor(r + 0.5) : ceil(r - 0.5);
+}
+
void thread_FileCopy(uint64_t /*arg*/)
{
gamePKG->nStatus = STATUS_COPY_START;
- FILE *filer, *filew;
- int numr, numw;
- char *buffer;
+ FILE *filer = NULL;
+ FILE *filew = NULL;
+ uint64_t numr = 0; // elements read
+ uint64_t numw = 0; // elements wrote
+ uint64_t nTotalRead = 0;
+ double nCopyPct = 0.0f;
+ double nTotDelta = 0.0f;
+ uint32_t nApproxTotDelta = 0;
+
+ char *buffer = NULL;
buffer = (char*)malloc(BUFF_SIZE);
filer = fopen(gamePKG->pkglst[gamePKG->nSelectedPKG].path,"rb");
@@ -943,6 +961,7 @@ void thread_FileCopy(uint64_t /*arg*/)
while(feof(filer) == 0)
{
+ // read
if((numr = fread(buffer, 1, BUFF_SIZE, filer)) != BUFF_SIZE)
{
if(ferror(filer) != 0)
@@ -955,12 +974,72 @@ void thread_FileCopy(uint64_t /*arg*/)
// ...
}
}
+
+ // write
if((numw = fwrite(buffer, 1, numr, filew)) != numr)
{
bCopyError = true;
break;
}
+
+ nTotalRead += numr;
+
+ nCopyPct = (double)(((double)numr / (double)gamePKG->pkglst[gamePKG->nSelectedPKG].nSize) * 100.0f);
+ double nTotalPct = (double)((double)nTotalRead / (double)gamePKG->pkglst[gamePKG->nSelectedPKG].nSize) * 100.0f;
+
+ nTotDelta += nCopyPct;
+ nApproxTotDelta += (uint32_t)round(nCopyPct);
+
+ if((double)nApproxTotDelta < nTotalPct)
+ {
+ // Compensate loss of float/double data, as for example: approx 70% vs. precise 95%
+ nApproxTotDelta += (uint32_t)(nTotalPct - (double)nApproxTotDelta);
+ nCopyPct += (nTotalPct - (double)nApproxTotDelta);
+ }
+ cellMsgDialogProgressBarInc(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE, (uint32_t)nCopyPct);
+
+ char msg[256] = "";
+ sprintf(
+ msg,
+ //"%.2f %s / %.2f %s (%.1f %%)(delta: %d %%)",
+ "%.2f %s / %.2f %s",
+ GetByteUnit(nTotalRead),
+ GetByteUnitStr(nTotalRead),
+ GetByteUnit(gamePKG->pkglst[gamePKG->nSelectedPKG].nSize),
+ GetByteUnitStr(gamePKG->pkglst[gamePKG->nSelectedPKG].nSize) //,
+ //nTotalPct,
+ //nApproxTotDelta
+ );
+ cellMsgDialogProgressBarSetMsg(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE, msg);
+ }
+
+ nCopyPct = (double)(((double)numr / (double)gamePKG->pkglst[gamePKG->nSelectedPKG].nSize) * 100.0f);
+ double nTotalPct = (double)((double)nTotalRead / (double)gamePKG->pkglst[gamePKG->nSelectedPKG].nSize) * 100.0f;
+
+ nTotDelta += nCopyPct;
+ nApproxTotDelta += (uint32_t)round(nCopyPct);
+
+ if((double)nApproxTotDelta < nTotalPct)
+ {
+ // Compensate loss of float/double data, as for example: approx 70% vs. precise 95%
+ nApproxTotDelta += (uint32_t)(nTotalPct - (double)nApproxTotDelta);
+ nCopyPct += (nTotalPct - (double)nApproxTotDelta);
}
+ cellMsgDialogProgressBarInc(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE, (uint32_t)nCopyPct);
+
+ char msg[256] = "";
+ sprintf(
+ msg,
+ //"%.2f %s / %.2f %s (%.1f %%)(delta: %d %%)",
+ "%.2f %s / %.2f %s",
+ GetByteUnit(nTotalRead),
+ GetByteUnitStr(nTotalRead),
+ GetByteUnit(gamePKG->pkglst[gamePKG->nSelectedPKG].nSize),
+ GetByteUnitStr(gamePKG->pkglst[gamePKG->nSelectedPKG].nSize) //,
+ //nTotalPct,
+ //nApproxTotDelta
+ );
+ cellMsgDialogProgressBarSetMsg(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE, msg);
if(filer) fclose(filer);
if(filew) fclose(filew);
@@ -997,6 +1076,8 @@ void thread_FileCopy(uint64_t /*arg*/)
buffer = NULL;
}
+ sys_timer_usleep(1000000); // wait 1 second
+
gamePKG->nStatus = STATUS_COPY_OK;
sys_ppu_thread_exit(0);
}
Please sign in to comment.
Something went wrong with that request. Please try again.