Skip to content

Commit

Permalink
Added support for ASUS CAP files
Browse files Browse the repository at this point in the history
  • Loading branch information
bigbigmdm committed Feb 2, 2024
1 parent f4e5b52 commit cd32886
Show file tree
Hide file tree
Showing 20 changed files with 1,513 additions and 1,341 deletions.
2 changes: 1 addition & 1 deletion IMSProg_programmer/dialogabout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ DialogAbout::DialogAbout(QWidget *parent) :
ui->label_7->setTextFormat(Qt::RichText);
ui->label_7->setTextInteractionFlags(Qt::TextBrowserInteraction);
ui->label_7->setOpenExternalLinks(true);
ui->label_8->setText("V1.1.10");
ui->label_8->setText("V1.1.11");
}

DialogAbout::~DialogAbout()
Expand Down
Binary file modified IMSProg_programmer/language/chipProgrammer_de_DE.qm
Binary file not shown.
349 changes: 182 additions & 167 deletions IMSProg_programmer/language/chipProgrammer_de_DE.ts

Large diffs are not rendered by default.

Binary file modified IMSProg_programmer/language/chipProgrammer_es_ES.qm
Binary file not shown.
349 changes: 182 additions & 167 deletions IMSProg_programmer/language/chipProgrammer_es_ES.ts

Large diffs are not rendered by default.

Binary file modified IMSProg_programmer/language/chipProgrammer_hu_HU.qm
Binary file not shown.
349 changes: 182 additions & 167 deletions IMSProg_programmer/language/chipProgrammer_hu_HU.ts

Large diffs are not rendered by default.

Binary file modified IMSProg_programmer/language/chipProgrammer_it_IT.qm
Binary file not shown.
349 changes: 182 additions & 167 deletions IMSProg_programmer/language/chipProgrammer_it_IT.ts

Large diffs are not rendered by default.

Binary file modified IMSProg_programmer/language/chipProgrammer_pt_BR.qm
Binary file not shown.
349 changes: 182 additions & 167 deletions IMSProg_programmer/language/chipProgrammer_pt_BR.ts

Large diffs are not rendered by default.

Binary file modified IMSProg_programmer/language/chipProgrammer_ru_RU.qm
Binary file not shown.
349 changes: 182 additions & 167 deletions IMSProg_programmer/language/chipProgrammer_ru_RU.ts

Large diffs are not rendered by default.

Binary file modified IMSProg_programmer/language/chipProgrammer_uk_UA.qm
Binary file not shown.
349 changes: 182 additions & 167 deletions IMSProg_programmer/language/chipProgrammer_uk_UA.ts

Large diffs are not rendered by default.

Binary file modified IMSProg_programmer/language/chipProgrammer_zn_CH.qm
Binary file not shown.
349 changes: 182 additions & 167 deletions IMSProg_programmer/language/chipProgrammer_zn_CH.ts

Large diffs are not rendered by default.

48 changes: 44 additions & 4 deletions IMSProg_programmer/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,13 +399,19 @@ void MainWindow::on_actionDetect_triggered()
void MainWindow::on_actionSave_triggered()
{

lastDirectory.replace(".cap", ".bin");
lastDirectory.replace(".CAP", ".bin");
lastDirectory.replace(".hex", ".bin");
lastDirectory.replace(".HEX", ".bin");

ui->statusBar->showMessage(tr("Saving file"));
fileName = QFileDialog::getSaveFileName(this,
QString(tr("Save file")),
lastDirectory,
"Data Images (*.bin *.BIN);;All files (*.*)");
QFileInfo info(fileName);
lastDirectory = info.filePath();

if (QString::compare(info.suffix(), "bin", Qt::CaseInsensitive)) fileName = fileName + ".bin";
QFile file(fileName);
if (!file.open(QIODevice::WriteOnly))
Expand Down Expand Up @@ -574,17 +580,51 @@ void MainWindow::on_actionOpen_triggered()
chipData.resize(static_cast<int>(info.size()));
}

for (uint32_t i=0; i < info.size(); i++)
{
chipData[i] = buf[i];
}
chipData.replace(0, static_cast<int>(info.size()), buf);
hexEdit->setData(chipData);

file.close();
//ui->statusBar->showMessage("");
ui->crcEdit->setText(getCRC32());
}

void MainWindow::on_actionExtract_from_ASUS_CAP_triggered()
{
QByteArray buf;
ui->statusBar->showMessage(tr("Opening file"));
fileName = QFileDialog::getOpenFileName(this,
QString(tr("Open file")),
lastDirectory,
"ASUS Data Images (*.cap *.CAP);;All files (*.*)");
QFileInfo info(fileName);
ui->statusBar->showMessage(tr("Current file: ") + info.fileName());
lastDirectory = info.filePath();
if ((info.size() - 0x800 > currentChipSize) && (currentChipSize != 0))
{
QMessageBox::about(this, tr("Error"), tr("The file size exceeds the chip size. Please select another chip or file or use `Save part` to split the file."));
return;
}
QFile file(fileName);

if (!file.open(QIODevice::ReadOnly))
{

return;
}
buf.resize(int(info.size()));
buf = file.readAll();
file.close();
fileName.clear();
buf.remove(0,0x800);
if (currentChipSize == 0)
{
chipData.resize(static_cast<int>(info.size()) - 0x800);
}
chipData.replace(0, static_cast<int>(info.size()) - 0x800, buf);
hexEdit->setData(chipData);
ui->crcEdit->setText(getCRC32());
}

void MainWindow::on_actionWrite_triggered()
{
//Writting data to chip
Expand Down
2 changes: 2 additions & 0 deletions IMSProg_programmer/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ private slots:

void on_actionImport_from_Intel_HEX_triggered();

void on_actionExtract_from_ASUS_CAP_triggered();

private:
Ui::MainWindow *ui;
QColor defaultTextColor;
Expand Down
10 changes: 10 additions & 0 deletions IMSProg_programmer/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,7 @@ QPushButton::pressed{background-color: rgb(115, 210, 22);}</string>
<addaction name="separator"/>
<addaction name="actionImport_from_Intel_HEX"/>
<addaction name="actionExport_to_Intel_HEX"/>
<addaction name="actionExtract_from_ASUS_CAP"/>
<addaction name="separator"/>
<addaction name="actionEdit_chips_Database"/>
<addaction name="separator"/>
Expand Down Expand Up @@ -1220,6 +1221,15 @@ QPushButton::pressed{background-color: rgb(115, 210, 22);}</string>
<string>Export to Intel HEX</string>
</property>
</action>
<action name="actionExtract_from_ASUS_CAP">
<property name="icon">
<iconset resource="recource.qrc">
<normaloff>:/res/img/open64.png</normaloff>:/res/img/open64.png</iconset>
</property>
<property name="text">
<string>Extract from ASUS CAP</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources>
Expand Down

0 comments on commit cd32886

Please sign in to comment.