Skip to content
Permalink
Browse files

Reworking templates.

  • Loading branch information...
U-MS\PowC U-MS\PowC
U-MS\PowC authored and U-MS\PowC committed Jan 31, 2019
1 parent 2f23110 commit 4cf8a17203fd5e2bad663bb7bf744ca0789ccf11
@@ -1886,7 +1886,7 @@ void MainWindow::explodeTemplate(int level,QString templateName,QString projectN
localDirTemp += "/";
}
localDir.mkpath(localDirTemp);
localDirTemp += fileInfo.fileName();
localDirTemp += fileInfo.fileName().replace(QRegExp("_in$"),"");

localDirTemp.replace(templateName,projectName);

@@ -1899,28 +1899,28 @@ void MainWindow::explodeTemplate(int level,QString templateName,QString projectN
// Save the file locally.
QFile templateFile(fileInfo.filePath());
QFile localFile(localDirTemp);
QString templateFileContent;
QByteArray templateFileContent;

if ( templateFile.open(QIODevice::ReadOnly) &&
localFile.open(QIODevice::ReadWrite|QIODevice::Truncate) )
{
templateFileContent = templateFile.readAll();

// If this is the project file, spit out the name and replace <!...!>'s.
if ( !fileInfo.suffix().compare("nesproject",Qt::CaseInsensitive) )
if ( !fileInfo.suffix().compare("nesproject_in",Qt::CaseInsensitive) )
{
templateFileContent.replace("<!project-title!>",nesicideProject->getProjectTitle());
templateFileContent.replace("<!project-mapper!>",QString::number(nesicideProject->getCartridge()->getMapperNumber()));
templateFileContent.replace("<!project-title!>",nesicideProject->getProjectTitle().toUtf8());
templateFileContent.replace("<!project-mapper!>",QString::number(nesicideProject->getCartridge()->getMapperNumber()).toUtf8());
(*projectFileName) = localFile.fileName();
}
else if ( !fileInfo.suffix().compare("c64project",Qt::CaseInsensitive) )
else if ( !fileInfo.suffix().compare("c64project_in",Qt::CaseInsensitive) )
{
templateFileContent.replace("<!project-title!>",nesicideProject->getProjectTitle());
templateFileContent.replace("<!project-mapper!>",QString::number(nesicideProject->getCartridge()->getMapperNumber()));
templateFileContent.replace("<!project-title!>",nesicideProject->getProjectTitle().toUtf8());
templateFileContent.replace("<!project-mapper!>",QString::number(nesicideProject->getCartridge()->getMapperNumber()).toUtf8());
(*projectFileName) = localFile.fileName();
}

localFile.write(templateFileContent.toUtf8());
localFile.write(templateFileContent);
}

templateFile.close();
@@ -1931,7 +1931,8 @@ void MainWindow::explodeTemplate(int level,QString templateName,QString projectN

void MainWindow::explodeINESHeaderTemplate(QString templateName,QString projectName,QString templateDirName,QString localDirName)
{
QFileInfo fileInfo = QFileInfo(":/templates/NES/header.s_in");
QString templateFileName = ":/templates/NES/"+templateName+"/header.s_in";
QFileInfo fileInfo = QFileInfo(templateFileName);
QDir localDir;
QString localDirTemp;

@@ -1942,8 +1943,6 @@ void MainWindow::explodeINESHeaderTemplate(QString templateName,QString projectN
localDir.mkpath(localDirTemp);
localDirTemp += fileInfo.fileName().replace("_in","");

localDirTemp.replace(templateName,projectName);

// Save the file locally.
QFile templateFile(fileInfo.filePath());
QFile localFile(localDirTemp);
@@ -2596,6 +2595,7 @@ void MainWindow::on_actionCompile_Project_triggered()
}
}
}

emit compile();
}

@@ -1,19 +1,16 @@
<RCC>
<qresource prefix="/">
<file>templates/NES/Hello World - CA65 Assembly/nes.ini</file>
<file>templates/NES/Hello World - CA65 Assembly/Hello World.nesproject</file>
<file>templates/NES/Hello World - CA65 Assembly/src/main.s</file>
<file>templates/NES/Hello World - CA65 Assembly/src/nes.h</file>
<file>templates/NES/Hello World - CA65 Assembly/tilesets/gamegfx.png</file>
<file>templates/NES/Hello World - CA65 Assembly/tilesets/titlegfx.png</file>
<file>templates/NES/Hello World - CC65 C/nes.ini</file>
<file>templates/NES/Hello World - CC65 C/Hello World.nesproject</file>
<file>templates/NES/Hello World - CC65 C/src/crt0.s</file>
<file>templates/NES/Hello World - CC65 C/src/main.c</file>
<file>templates/NES/Hello World - CC65 C/src/memmap.inc</file>
<file>templates/NES/Hello World - CC65 C/tilesets/gamegfx.png</file>
<file>templates/NES/Hello World - CC65 C/tilesets/titlegfx.png</file>
<file>templates/NES/Hello World - UC/Hello World.nesproject</file>
<file>templates/NES/Hello World - UC/lib/crt0.s</file>
<file>templates/NES/Hello World - UC/source/data.uc</file>
<file>templates/NES/Hello World - UC/source/main.uc</file>
@@ -24,6 +21,11 @@
<file>templates/NES/Hello World - UC/data/graphics.chr</file>
<file>templates/NES/Hello World - UC/data/graphics.nam</file>
<file>templates/NES/Hello World - UC/data/graphics.pal</file>
<file>templates/NES/header.s_in</file>
<file>templates/NES/Hello World - CA65 Assembly/Hello World.nesproject_in</file>
<file>templates/NES/Hello World - CC65 C/Hello World.nesproject_in</file>
<file>templates/NES/Hello World - UC/Hello World.nesproject_in</file>
<file>templates/NES/Hello World - CA65 Assembly/header.s_in</file>
<file>templates/NES/Hello World - CC65 C/header.s_in</file>
<file>templates/NES/Hello World - UC/header.s_in</file>
</qresource>
</RCC>
@@ -28,8 +28,8 @@
; +--------+------+------------------------------------------+

.byte $4e,$45,$53,$1a ; "NES"^Z
.byte $<!prg-banks!> ; ines prg - Specifies the number of 16k prg banks.
.byte $<!chr-banks!> ; ines chr - Specifies the number of 8k chr banks.
.byte $01 ; ines prg - Specifies the number of 16k prg banks.
.byte $01 ; ines chr - Specifies the number of 8k chr banks.
.byte $<!mapper-low!> ; ines mir - Specifies VRAM mirroring of the banks.
.byte $<!mapper-high!> ; ines map - Specifies the NES mapper used.
.byte 0,0,0,0,0,0,0,0 ; 8 zeroes
@@ -0,0 +1,36 @@
.segment "INESHDR"

; +--------+------+------------------------------------------+
; | Offset | Size | Content(s) |
; +--------+------+------------------------------------------+
; | 0 | 3 | 'NES' |
; | 3 | 1 | $1A |
; | 4 | 1 | 16K PRG-ROM page count |
; | 5 | 1 | 8K CHR-ROM page count |
; | 6 | 1 | ROM Control Byte #1 |
; | | | %####vTsM |
; | | | | ||||+- 0=Horizontal mirroring |
; | | | | |||| 1=Vertical mirroring |
; | | | | |||+-- 1=SRAM enabled |
; | | | | ||+--- 1=512-byte trainer present |
; | | | | |+---- 1=Four-screen mirroring |
; | | | | | |
; | | | +--+----- Mapper # (lower 4-bits) |
; | 7 | 1 | ROM Control Byte #2 |
; | | | %####0000 |
; | | | | | |
; | | | +--+----- Mapper # (upper 4-bits) |
; | 8-15 | 8 | $00 |
; | 16-.. | | Actual 16K PRG-ROM pages (in linear |
; | ... | | order). If a trainer exists, it precedes |
; | ... | | the first PRG-ROM page. |
; | ..-EOF | | CHR-ROM pages (in ascending order). |
; +--------+------+------------------------------------------+

.byte $4e,$45,$53,$1a ; "NES"^Z
.byte $01 ; ines prg - Specifies the number of 16k prg banks.
.byte $01 ; ines chr - Specifies the number of 8k chr banks.
.byte $<!mapper-low!> ; ines mir - Specifies VRAM mirroring of the banks.
.byte $<!mapper-high!> ; ines map - Specifies the NES mapper used.
.byte 0,0,0,0,0,0,0,0 ; 8 zeroes

@@ -0,0 +1,36 @@
.segment "INESHDR"

; +--------+------+------------------------------------------+
; | Offset | Size | Content(s) |
; +--------+------+------------------------------------------+
; | 0 | 3 | 'NES' |
; | 3 | 1 | $1A |
; | 4 | 1 | 16K PRG-ROM page count |
; | 5 | 1 | 8K CHR-ROM page count |
; | 6 | 1 | ROM Control Byte #1 |
; | | | %####vTsM |
; | | | | ||||+- 0=Horizontal mirroring |
; | | | | |||| 1=Vertical mirroring |
; | | | | |||+-- 1=SRAM enabled |
; | | | | ||+--- 1=512-byte trainer present |
; | | | | |+---- 1=Four-screen mirroring |
; | | | | | |
; | | | +--+----- Mapper # (lower 4-bits) |
; | 7 | 1 | ROM Control Byte #2 |
; | | | %####0000 |
; | | | | | |
; | | | +--+----- Mapper # (upper 4-bits) |
; | 8-15 | 8 | $00 |
; | 16-.. | | Actual 16K PRG-ROM pages (in linear |
; | ... | | order). If a trainer exists, it precedes |
; | ... | | the first PRG-ROM page. |
; | ..-EOF | | CHR-ROM pages (in ascending order). |
; +--------+------+------------------------------------------+

.byte $4e,$45,$53,$1a ; "NES"^Z
.byte $01 ; ines prg - Specifies the number of 16k prg banks.
.byte $01 ; ines chr - Specifies the number of 8k chr banks.
.byte $<!mapper-low!> ; ines mir - Specifies VRAM mirroring of the banks.
.byte $<!mapper-high!> ; ines map - Specifies the NES mapper used.
.byte 0,0,0,0,0,0,0,0 ; 8 zeroes

@@ -22,4 +22,3 @@ echo Building FamiPlayer...
( cd build/famiplayer; qmake; make )
echo Building NES Emulator...
( cd build/nes-emulator; qmake; make )

0 comments on commit 4cf8a17

Please sign in to comment.
You can’t perform that action at this time.