# New Features #
- Installable via cmake - Dont run makerom and makebanner in 3dsx mode
This commit is contained in:
parent
c7083ac77e
commit
d464128d78
@ -13,3 +13,5 @@ source/icon.cpp
|
||||
source/logo_lz11.cpp
|
||||
source/samplefiles.cpp)
|
||||
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 <vector>
|
||||
|
||||
struct NpiProject {
|
||||
struct NpiProject
|
||||
{
|
||||
std::string name;
|
||||
std::string author;
|
||||
std::string description;
|
||||
@ -16,18 +17,19 @@ struct NpiProject {
|
||||
std::vector<std::string> lib_dirs;
|
||||
|
||||
std::string icon_path;
|
||||
std::string banner_path;
|
||||
std::string banner_a_path;
|
||||
std::string rsf_path;
|
||||
std::string logo_lz11_path;
|
||||
std::string banner_path; // depends ctr_type
|
||||
std::string banner_a_path; // depends ctr_type
|
||||
std::string rsf_path; // depends ctr_type
|
||||
std::string logo_lz11_path; // depends ctr_type
|
||||
|
||||
std::string dir_gfx;
|
||||
std::string dir_gfxbuild;
|
||||
std::string dir_romfs;
|
||||
|
||||
std::string unique_id;
|
||||
std::string prod;
|
||||
std::string unique_id; // depends ctr_type
|
||||
std::string prod; // depends ctr_type
|
||||
std::string platform; // Platforms: 3ds, desktop
|
||||
bool ctr_type; // depends platform
|
||||
|
||||
std::vector<std::string> arch_flags;
|
||||
std::vector<std::string> c_flags;
|
||||
@ -41,7 +43,8 @@ struct NpiProject {
|
||||
std::string asm_compiler;
|
||||
};
|
||||
|
||||
inline void Prj_InitDefault(NpiProject &project) {
|
||||
inline void Prj_InitDefault(NpiProject &project, bool cia)
|
||||
{
|
||||
project.name = "Sample";
|
||||
project.author = "Sample";
|
||||
project.description = "Description";
|
||||
@ -96,16 +99,22 @@ inline void Prj_InitDefault(NpiProject &project) {
|
||||
project.asm_compiler = "{DEVKITPRO}/devkitARM/bin/arm-none-eabi-gcc";
|
||||
|
||||
project.icon_path = "app/icon.png";
|
||||
if (cia)
|
||||
{
|
||||
project.banner_path = "app/banner.png";
|
||||
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_gfxbuild = "romfs/gfx/";
|
||||
project.dir_romfs = "romfs/";
|
||||
|
||||
if (cia)
|
||||
{
|
||||
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());
|
||||
if (reqres != 0)
|
||||
any_errors = true;
|
||||
if (prj.ctr_type)
|
||||
{
|
||||
command = "bannertool makebanner -i \"app/banner.png\" -a "
|
||||
"\"app/BannerAudio.wav\" -o \"build/banner.bin\"";
|
||||
std::cout << CCBLUE << "[+] Creating Banner..." << CCRESET << 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 +
|
||||
"\" -l \"Description\" -p \"" + prj.author +
|
||||
"\" -o \"build/icon.bin\"";
|
||||
@ -516,6 +519,8 @@ void CompileProject(NpiProject &prj, std::string dir_)
|
||||
std::cout << (reqres == 0 ? CCGREEN : CCRED)
|
||||
<< (reqres == 0 ? "[+] " : "[-] ") << prj.name + ".3dsx "
|
||||
<< std::endl;
|
||||
if (prj.ctr_type)
|
||||
{
|
||||
command =
|
||||
"makerom -f cia -target t -exefslogo -o " + dir_ + "/" + prj.name +
|
||||
".cia -elf " + dir_ + "/" + prj.name + ".elf " + " -rsf " + dir_ + "/" +
|
||||
@ -531,6 +536,7 @@ void CompileProject(NpiProject &prj, std::string dir_)
|
||||
<< (reqres == 0 ? "[+] " : "[-] ") << prj.name + ".cia "
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (any_errors)
|
||||
{
|
||||
@ -588,9 +594,16 @@ namespace helper
|
||||
js["vmajor"] = prj.vmajor;
|
||||
js["vminor"] = prj.vminor;
|
||||
js["vbuild"] = prj.vbuild;
|
||||
if (prj.ctr_type)
|
||||
{
|
||||
js["unique_id"] = prj.unique_id;
|
||||
js["prod_code"] = prj.prod;
|
||||
}
|
||||
js["platform"] = prj.platform;
|
||||
if (prj.platform == "3ds")
|
||||
{
|
||||
js["cia"] = prj.ctr_type;
|
||||
}
|
||||
|
||||
nlohmann::json source_dirs;
|
||||
Vec2Json(prj.source_dirs, source_dirs, prj);
|
||||
@ -609,10 +622,13 @@ namespace helper
|
||||
js["lib_dirs"] = lib_dirs;
|
||||
|
||||
js["icon_path"] = prj.icon_path;
|
||||
if (prj.ctr_type)
|
||||
{
|
||||
js["banner_path"] = prj.banner_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_gfxbuild"] = prj.dir_gfxbuild;
|
||||
@ -678,16 +694,31 @@ namespace helper
|
||||
auto __vmajor = js_catch<int>(js, "vmajor");
|
||||
auto __vminor = js_catch<int>(js, "vminor");
|
||||
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 __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 __banner_path = js_catch<std::string>(js, "banner_path");
|
||||
auto __banner_a_path = js_catch<std::string>(js, "banner_a_path");
|
||||
auto __rsf_path = js_catch<std::string>(js, "rsf_path");
|
||||
auto __logo_lz11_path = js_catch<std::string>(js, "logo_lz11_path");
|
||||
if (__ctr_type.first)
|
||||
{
|
||||
__banner_path = js_catch<std::string>(js, "banner_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_gfxbuild = js_catch<std::string>(js, "dir_gfxbuild");
|
||||
auto __dir_romfs = js_catch<std::string>(js, "dir_romfs");
|
||||
@ -706,6 +737,7 @@ namespace helper
|
||||
prj.unique_id = __unique_id.first;
|
||||
prj.prod = __prod.first;
|
||||
prj.platform = __platform.first;
|
||||
prj.ctr_type = __ctr_type.first;
|
||||
|
||||
prj.icon_path = __icon_path.first;
|
||||
prj.banner_path = __banner_path.first;
|
||||
|
@ -188,7 +188,7 @@ void ProcessArgs(int argc, char *argv[])
|
||||
}
|
||||
// Generate Default build.json
|
||||
NpiProject npr;
|
||||
Prj_InitDefault(npr);
|
||||
Prj_InitDefault(npr, (type_ == 1));
|
||||
helper::GenerateTemplateFile(dst_dir + "/build.json", npr);
|
||||
}
|
||||
else if (std::string(argv[1]) == "generate-assist")
|
||||
@ -276,10 +276,13 @@ void ProcessArgs(int argc, char *argv[])
|
||||
}
|
||||
// Create build.json
|
||||
NpiProject npr;
|
||||
Prj_InitDefault(npr);
|
||||
Prj_InitDefault(npr, (type_ == 1));
|
||||
npr.name = prj_name;
|
||||
if (npr.ctr_type)
|
||||
{
|
||||
npr.prod = prodcode;
|
||||
npr.unique_id = unique_id;
|
||||
}
|
||||
helper::GenerateTemplateFile(dst_dir + "/build.json", npr);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user