# New Features #
- Installable via cmake - Dont run makerom and makebanner in 3dsx mode
This commit is contained in:
parent
c7083ac77e
commit
d464128d78
@ -12,4 +12,6 @@ source/helper.cpp
|
|||||||
source/icon.cpp
|
source/icon.cpp
|
||||||
source/logo_lz11.cpp
|
source/logo_lz11.cpp
|
||||||
source/samplefiles.cpp)
|
source/samplefiles.cpp)
|
||||||
target_include_directories(npi-build PUBLIC include)
|
target_include_directories(npi-build PUBLIC include)
|
||||||
|
|
||||||
|
install(TARGETS npi-build DESTINATION bin)
|
5
build.sh
5
build.sh
@ -1,5 +0,0 @@
|
|||||||
#Script to build
|
|
||||||
echo "Building with g++..."
|
|
||||||
g++ -g -o npi-build source/main.cpp source/samplefiles.cpp source/helper.cpp source/banner_audio.cpp source/logo_lz11.cpp source/icon.cpp source/banner.cpp -I include
|
|
||||||
echo "installing..."
|
|
||||||
sudo cp npi-build /usr/local/bin/
|
|
@ -3,7 +3,8 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
struct NpiProject {
|
struct NpiProject
|
||||||
|
{
|
||||||
std::string name;
|
std::string name;
|
||||||
std::string author;
|
std::string author;
|
||||||
std::string description;
|
std::string description;
|
||||||
@ -16,18 +17,19 @@ struct NpiProject {
|
|||||||
std::vector<std::string> lib_dirs;
|
std::vector<std::string> lib_dirs;
|
||||||
|
|
||||||
std::string icon_path;
|
std::string icon_path;
|
||||||
std::string banner_path;
|
std::string banner_path; // depends ctr_type
|
||||||
std::string banner_a_path;
|
std::string banner_a_path; // depends ctr_type
|
||||||
std::string rsf_path;
|
std::string rsf_path; // depends ctr_type
|
||||||
std::string logo_lz11_path;
|
std::string logo_lz11_path; // depends ctr_type
|
||||||
|
|
||||||
std::string dir_gfx;
|
std::string dir_gfx;
|
||||||
std::string dir_gfxbuild;
|
std::string dir_gfxbuild;
|
||||||
std::string dir_romfs;
|
std::string dir_romfs;
|
||||||
|
|
||||||
std::string unique_id;
|
std::string unique_id; // depends ctr_type
|
||||||
std::string prod;
|
std::string prod; // depends ctr_type
|
||||||
std::string platform; // Platforms: 3ds, desktop
|
std::string platform; // Platforms: 3ds, desktop
|
||||||
|
bool ctr_type; // depends platform
|
||||||
|
|
||||||
std::vector<std::string> arch_flags;
|
std::vector<std::string> arch_flags;
|
||||||
std::vector<std::string> c_flags;
|
std::vector<std::string> c_flags;
|
||||||
@ -41,7 +43,8 @@ struct NpiProject {
|
|||||||
std::string asm_compiler;
|
std::string asm_compiler;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void Prj_InitDefault(NpiProject &project) {
|
inline void Prj_InitDefault(NpiProject &project, bool cia)
|
||||||
|
{
|
||||||
project.name = "Sample";
|
project.name = "Sample";
|
||||||
project.author = "Sample";
|
project.author = "Sample";
|
||||||
project.description = "Description";
|
project.description = "Description";
|
||||||
@ -96,16 +99,22 @@ inline void Prj_InitDefault(NpiProject &project) {
|
|||||||
project.asm_compiler = "{DEVKITPRO}/devkitARM/bin/arm-none-eabi-gcc";
|
project.asm_compiler = "{DEVKITPRO}/devkitARM/bin/arm-none-eabi-gcc";
|
||||||
|
|
||||||
project.icon_path = "app/icon.png";
|
project.icon_path = "app/icon.png";
|
||||||
project.banner_path = "app/banner.png";
|
if (cia)
|
||||||
project.banner_a_path = "app/banner_audio.wav";
|
{
|
||||||
project.rsf_path = "app/build-cia.rsf";
|
project.banner_path = "app/banner.png";
|
||||||
project.logo_lz11_path = "app/logo.lz11";
|
project.banner_a_path = "app/banner_audio.wav";
|
||||||
|
project.rsf_path = "app/build-cia.rsf";
|
||||||
|
project.logo_lz11_path = "app/logo.lz11";
|
||||||
|
}
|
||||||
project.dir_gfx = "gfx/";
|
project.dir_gfx = "gfx/";
|
||||||
project.dir_gfxbuild = "romfs/gfx/";
|
project.dir_gfxbuild = "romfs/gfx/";
|
||||||
project.dir_romfs = "romfs/";
|
project.dir_romfs = "romfs/";
|
||||||
|
|
||||||
project.unique_id = "0xff3ff";
|
if (cia)
|
||||||
project.prod = "NPI7";
|
{
|
||||||
|
project.unique_id = "0xff3ff";
|
||||||
|
project.prod = "NPI7";
|
||||||
|
}
|
||||||
project.platform = "3ds";
|
project.platform = "3ds";
|
||||||
|
project.ctr_type = cia;
|
||||||
}
|
}
|
@ -494,12 +494,15 @@ void CompileProject(NpiProject &prj, std::string dir_)
|
|||||||
int reqres = system(command.c_str());
|
int reqres = system(command.c_str());
|
||||||
if (reqres != 0)
|
if (reqres != 0)
|
||||||
any_errors = true;
|
any_errors = true;
|
||||||
command = "bannertool makebanner -i \"app/banner.png\" -a "
|
if (prj.ctr_type)
|
||||||
"\"app/BannerAudio.wav\" -o \"build/banner.bin\"";
|
{
|
||||||
std::cout << CCBLUE << "[+] Creating Banner..." << CCRESET << std::endl;
|
command = "bannertool makebanner -i \"app/banner.png\" -a "
|
||||||
reqres = system(command.c_str());
|
"\"app/BannerAudio.wav\" -o \"build/banner.bin\"";
|
||||||
std::cout << (reqres == 0 ? CCGREEN : CCRED)
|
std::cout << CCBLUE << "[+] Creating Banner..." << CCRESET << std::endl;
|
||||||
<< (reqres == 0 ? "[+] " : "[-] ") << "Banner" << std::endl;
|
reqres = system(command.c_str());
|
||||||
|
std::cout << (reqres == 0 ? CCGREEN : CCRED)
|
||||||
|
<< (reqres == 0 ? "[+] " : "[-] ") << "Banner" << std::endl;
|
||||||
|
}
|
||||||
command = "bannertool makesmdh -i \"app/icon.png\" -s \"" + prj.name +
|
command = "bannertool makesmdh -i \"app/icon.png\" -s \"" + prj.name +
|
||||||
"\" -l \"Description\" -p \"" + prj.author +
|
"\" -l \"Description\" -p \"" + prj.author +
|
||||||
"\" -o \"build/icon.bin\"";
|
"\" -o \"build/icon.bin\"";
|
||||||
@ -516,20 +519,23 @@ void CompileProject(NpiProject &prj, std::string dir_)
|
|||||||
std::cout << (reqres == 0 ? CCGREEN : CCRED)
|
std::cout << (reqres == 0 ? CCGREEN : CCRED)
|
||||||
<< (reqres == 0 ? "[+] " : "[-] ") << prj.name + ".3dsx "
|
<< (reqres == 0 ? "[+] " : "[-] ") << prj.name + ".3dsx "
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
command =
|
if (prj.ctr_type)
|
||||||
"makerom -f cia -target t -exefslogo -o " + dir_ + "/" + prj.name +
|
{
|
||||||
".cia -elf " + dir_ + "/" + prj.name + ".elf " + " -rsf " + dir_ + "/" +
|
command =
|
||||||
prj.rsf_path + " -banner " + dir_ + "/build/banner.bin" + " -icon " +
|
"makerom -f cia -target t -exefslogo -o " + dir_ + "/" + prj.name +
|
||||||
dir_ + "/build/icon.bin" + " -logo " + dir_ + "/" + prj.logo_lz11_path +
|
".cia -elf " + dir_ + "/" + prj.name + ".elf " + " -rsf " + dir_ + "/" +
|
||||||
" -DAPP_ROMFS=" + dir_ + "/" + prj.dir_romfs + " -major " +
|
prj.rsf_path + " -banner " + dir_ + "/build/banner.bin" + " -icon " +
|
||||||
std::to_string(prj.vmajor) + " -minor " + std::to_string(prj.vminor) +
|
dir_ + "/build/icon.bin" + " -logo " + dir_ + "/" + prj.logo_lz11_path +
|
||||||
" -micro " + std::to_string(prj.vbuild) +
|
" -DAPP_ROMFS=" + dir_ + "/" + prj.dir_romfs + " -major " +
|
||||||
" -DAPP_VERSION_MAJOR=" + std::to_string(prj.vmajor);
|
std::to_string(prj.vmajor) + " -minor " + std::to_string(prj.vminor) +
|
||||||
std::cout << CCBLUE << "[+] Creating Cia..." << CCRESET << std::endl;
|
" -micro " + std::to_string(prj.vbuild) +
|
||||||
reqres = system(command.c_str());
|
" -DAPP_VERSION_MAJOR=" + std::to_string(prj.vmajor);
|
||||||
std::cout << (reqres == 0 ? CCGREEN : CCRED)
|
std::cout << CCBLUE << "[+] Creating Cia..." << CCRESET << std::endl;
|
||||||
<< (reqres == 0 ? "[+] " : "[-] ") << prj.name + ".cia "
|
reqres = system(command.c_str());
|
||||||
<< std::endl;
|
std::cout << (reqres == 0 ? CCGREEN : CCRED)
|
||||||
|
<< (reqres == 0 ? "[+] " : "[-] ") << prj.name + ".cia "
|
||||||
|
<< std::endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (any_errors)
|
if (any_errors)
|
||||||
@ -588,9 +594,16 @@ namespace helper
|
|||||||
js["vmajor"] = prj.vmajor;
|
js["vmajor"] = prj.vmajor;
|
||||||
js["vminor"] = prj.vminor;
|
js["vminor"] = prj.vminor;
|
||||||
js["vbuild"] = prj.vbuild;
|
js["vbuild"] = prj.vbuild;
|
||||||
js["unique_id"] = prj.unique_id;
|
if (prj.ctr_type)
|
||||||
js["prod_code"] = prj.prod;
|
{
|
||||||
|
js["unique_id"] = prj.unique_id;
|
||||||
|
js["prod_code"] = prj.prod;
|
||||||
|
}
|
||||||
js["platform"] = prj.platform;
|
js["platform"] = prj.platform;
|
||||||
|
if (prj.platform == "3ds")
|
||||||
|
{
|
||||||
|
js["cia"] = prj.ctr_type;
|
||||||
|
}
|
||||||
|
|
||||||
nlohmann::json source_dirs;
|
nlohmann::json source_dirs;
|
||||||
Vec2Json(prj.source_dirs, source_dirs, prj);
|
Vec2Json(prj.source_dirs, source_dirs, prj);
|
||||||
@ -609,10 +622,13 @@ namespace helper
|
|||||||
js["lib_dirs"] = lib_dirs;
|
js["lib_dirs"] = lib_dirs;
|
||||||
|
|
||||||
js["icon_path"] = prj.icon_path;
|
js["icon_path"] = prj.icon_path;
|
||||||
js["banner_path"] = prj.banner_path;
|
if (prj.ctr_type)
|
||||||
js["banner_a_path"] = prj.banner_a_path;
|
{
|
||||||
js["rsf_path"] = prj.rsf_path;
|
js["banner_path"] = prj.banner_path;
|
||||||
js["logo_lz11_path"] = prj.logo_lz11_path;
|
js["banner_a_path"] = prj.banner_a_path;
|
||||||
|
js["rsf_path"] = prj.rsf_path;
|
||||||
|
js["logo_lz11_path"] = prj.logo_lz11_path;
|
||||||
|
}
|
||||||
|
|
||||||
js["dir_gfx"] = prj.dir_gfx;
|
js["dir_gfx"] = prj.dir_gfx;
|
||||||
js["dir_gfxbuild"] = prj.dir_gfxbuild;
|
js["dir_gfxbuild"] = prj.dir_gfxbuild;
|
||||||
@ -678,16 +694,31 @@ namespace helper
|
|||||||
auto __vmajor = js_catch<int>(js, "vmajor");
|
auto __vmajor = js_catch<int>(js, "vmajor");
|
||||||
auto __vminor = js_catch<int>(js, "vminor");
|
auto __vminor = js_catch<int>(js, "vminor");
|
||||||
auto __vbuild = js_catch<int>(js, "vbuild");
|
auto __vbuild = js_catch<int>(js, "vbuild");
|
||||||
auto __description = js_catch<std::string>(js, "description");
|
|
||||||
auto __unique_id = js_catch<std::string>(js, "unique_id");
|
|
||||||
auto __prod = js_catch<std::string>(js, "prod_code");
|
|
||||||
auto __platform = js_catch<std::string>(js, "platform");
|
auto __platform = js_catch<std::string>(js, "platform");
|
||||||
|
auto __ctr_type = js_catch<bool>(js, "cia");
|
||||||
|
auto __description = js_catch<std::string>(js, "description");
|
||||||
|
|
||||||
|
std::pair<std::string, bool> __unique_id;
|
||||||
|
std::pair<std::string, bool> __prod;
|
||||||
|
if (__ctr_type.first)
|
||||||
|
{
|
||||||
|
__unique_id = js_catch<std::string>(js, "unique_id");
|
||||||
|
__prod = js_catch<std::string>(js, "prod_code");
|
||||||
|
}
|
||||||
|
|
||||||
|
std::pair<std::string, bool> __banner_path;
|
||||||
|
std::pair<std::string, bool> __banner_a_path;
|
||||||
|
std::pair<std::string, bool> __rsf_path;
|
||||||
|
std::pair<std::string, bool> __logo_lz11_path;
|
||||||
|
|
||||||
auto __icon_path = js_catch<std::string>(js, "icon_path");
|
auto __icon_path = js_catch<std::string>(js, "icon_path");
|
||||||
auto __banner_path = js_catch<std::string>(js, "banner_path");
|
if (__ctr_type.first)
|
||||||
auto __banner_a_path = js_catch<std::string>(js, "banner_a_path");
|
{
|
||||||
auto __rsf_path = js_catch<std::string>(js, "rsf_path");
|
__banner_path = js_catch<std::string>(js, "banner_path");
|
||||||
auto __logo_lz11_path = js_catch<std::string>(js, "logo_lz11_path");
|
__banner_a_path = js_catch<std::string>(js, "banner_a_path");
|
||||||
|
__rsf_path = js_catch<std::string>(js, "rsf_path");
|
||||||
|
__logo_lz11_path = js_catch<std::string>(js, "logo_lz11_path");
|
||||||
|
}
|
||||||
auto __dir_gfx = js_catch<std::string>(js, "dir_gfx");
|
auto __dir_gfx = js_catch<std::string>(js, "dir_gfx");
|
||||||
auto __dir_gfxbuild = js_catch<std::string>(js, "dir_gfxbuild");
|
auto __dir_gfxbuild = js_catch<std::string>(js, "dir_gfxbuild");
|
||||||
auto __dir_romfs = js_catch<std::string>(js, "dir_romfs");
|
auto __dir_romfs = js_catch<std::string>(js, "dir_romfs");
|
||||||
@ -706,6 +737,7 @@ namespace helper
|
|||||||
prj.unique_id = __unique_id.first;
|
prj.unique_id = __unique_id.first;
|
||||||
prj.prod = __prod.first;
|
prj.prod = __prod.first;
|
||||||
prj.platform = __platform.first;
|
prj.platform = __platform.first;
|
||||||
|
prj.ctr_type = __ctr_type.first;
|
||||||
|
|
||||||
prj.icon_path = __icon_path.first;
|
prj.icon_path = __icon_path.first;
|
||||||
prj.banner_path = __banner_path.first;
|
prj.banner_path = __banner_path.first;
|
||||||
|
@ -188,7 +188,7 @@ void ProcessArgs(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
// Generate Default build.json
|
// Generate Default build.json
|
||||||
NpiProject npr;
|
NpiProject npr;
|
||||||
Prj_InitDefault(npr);
|
Prj_InitDefault(npr, (type_ == 1));
|
||||||
helper::GenerateTemplateFile(dst_dir + "/build.json", npr);
|
helper::GenerateTemplateFile(dst_dir + "/build.json", npr);
|
||||||
}
|
}
|
||||||
else if (std::string(argv[1]) == "generate-assist")
|
else if (std::string(argv[1]) == "generate-assist")
|
||||||
@ -276,10 +276,13 @@ void ProcessArgs(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
// Create build.json
|
// Create build.json
|
||||||
NpiProject npr;
|
NpiProject npr;
|
||||||
Prj_InitDefault(npr);
|
Prj_InitDefault(npr, (type_ == 1));
|
||||||
npr.name = prj_name;
|
npr.name = prj_name;
|
||||||
npr.prod = prodcode;
|
if (npr.ctr_type)
|
||||||
npr.unique_id = unique_id;
|
{
|
||||||
|
npr.prod = prodcode;
|
||||||
|
npr.unique_id = unique_id;
|
||||||
|
}
|
||||||
helper::GenerateTemplateFile(dst_dir + "/build.json", npr);
|
helper::GenerateTemplateFile(dst_dir + "/build.json", npr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user