diff options
Diffstat (limited to 'public')
| -rw-r--r-- | public/tools/diutil/src/CommandLine.cc | 8 | ||||
| -rw-r--r-- | public/tools/make_app/Steps.h | 20 | ||||
| -rw-r--r-- | public/tools/make_app/src/CommandLine.cc | 48 |
3 files changed, 55 insertions, 21 deletions
diff --git a/public/tools/diutil/src/CommandLine.cc b/public/tools/diutil/src/CommandLine.cc index 9f11e778..604520a9 100644 --- a/public/tools/diutil/src/CommandLine.cc +++ b/public/tools/diutil/src/CommandLine.cc @@ -9,10 +9,10 @@ #include <DiskImage.fwrk/headers/DiskImage.h> -static const Char kDiskName[kDIDiskNameLen] = "Disk"; -static SInt32 kDiskSectorSz = 512; -static SizeT kDiskSz = gib_cast(4); -static const Char kOutDisk[kDIOutNameLen] = "disk.eimg"; +static const Char kDiskName[kDIDiskNameLen] = "Disk"; +static SInt32 kDiskSectorSz = 512; +static SizeT kDiskSz = gib_cast(4); +static const Char kOutDisk[kDIOutNameLen] = "disk.eimg"; /// @brief Filesystem tool entrypoint. int main(int argc, char** argv) diff --git a/public/tools/make_app/Steps.h b/public/tools/make_app/Steps.h index 76976dd3..51927def 100644 --- a/public/tools/make_app/Steps.h +++ b/public/tools/make_app/Steps.h @@ -12,15 +12,21 @@ #define kStepsExtension ".stp" #define kStepsStrLen (256U) +#define kStepsMagic " pls" +#define kStepsMagicLen (4U) +#define kStepsVersion (0x0100) + +#define kStepsMime "ne-application-kind/steps" + struct STEPS_COMMON_RECORD final { - SInt32 setup_magic; - Char setup_name[kStepsStrLen]; - Char setup_company[kStepsStrLen]; - Char setup_author[kStepsStrLen]; - SInt32 setup_version; - SInt32 setup_pages; - SInt32 setup_check_page, setup_eula_page; + Char magic[kStepsMagicLen]; + Char name[kStepsStrLen]; + Char company[kStepsStrLen]; + Char author[kStepsStrLen]; + SInt32 version; + SInt32 pages; + SInt32 check_page, eula_page; }; #endif // ifndef APPS_STEPS_H
\ No newline at end of file diff --git a/public/tools/make_app/src/CommandLine.cc b/public/tools/make_app/src/CommandLine.cc index a00e0ec0..c30e02a0 100644 --- a/public/tools/make_app/src/CommandLine.cc +++ b/public/tools/make_app/src/CommandLine.cc @@ -7,9 +7,15 @@ #include <Framework.h> #include <Steps.h> +#include <user/ProcessCodes.h> + #include <CoreFoundation.fwrk/headers/Array.h> -/// @brief This program makes a framework directory for NeKernel OS. +/// @brief This program makes a framework/app/steps directory for NeKernel OS. + +static Char* kStepsName = "Steps"; +static Char* kStepsAuthor = "John Doe"; +static Char* kStepsCompany = "Company, Inc"; int main(int argc, char* argv[]) { @@ -28,7 +34,25 @@ int main(int argc, char* argv[]) PrintOut(nullptr, "%s", "make_app: -s: Steps (Setup pages) format.\n"); PrintOut(nullptr, "%s", "make_app: -f: Framework format.\n"); - return EXIT_SUCCESS; + return kErrorSuccess; + } + + if (MmStrCmp(argv[i], "--author") == 0) + { + MmCopyMemory(kStepsAuthor, const_cast<Char*>(argv[i + 1]), MmStrLen(argv[i + 1])); + continue; + } + + if (MmStrCmp(argv[i], "--company") == 0) + { + MmCopyMemory(kStepsCompany, const_cast<Char*>(argv[i + 1]), MmStrLen(argv[i + 1])); + continue; + } + + if (MmStrCmp(argv[i], "--name") == 0) + { + MmCopyMemory(kStepsName, const_cast<Char*>(argv[i + 1]), MmStrLen(argv[i + 1])); + continue; } if (MmStrCmp(argv[i], "-a") == 0) @@ -63,13 +87,17 @@ int main(int argc, char* argv[]) auto handle = IoOpenFile(StrFmt("{}{}{}{}", path, kRootDirectory, "_setup", kStepsExtension), nullptr); - struct STEPS_COMMON_RECORD record - { - 0 - }; + struct STEPS_COMMON_RECORD record; + + MmFillMemory(&record, sizeof(STEPS_COMMON_RECORD), 0); + + MmCopyMemory(record.name, const_cast<Char*>(kStepsName), kStepsStrLen); + MmCopyMemory(record.author, const_cast<Char*>(kStepsAuthor), kStepsStrLen); + MmCopyMemory(record.company, const_cast<Char*>(kStepsCompany), kStepsStrLen); + + MmCopyMemory(record.magic, const_cast<Char*>(kStepsMagic), kStepsMagicLen); - record.setup_magic = 0xAABB; - record.setup_version = 1; + record.version = kStepsVersion; IoWriteFile(handle, (void*)&record, sizeof(STEPS_COMMON_RECORD)); IoCloseFile(handle); @@ -84,8 +112,8 @@ int main(int argc, char* argv[]) FsCopy(path, StrFmt("{}{}", path, file)); } - return EXIT_SUCCESS; + return kErrorSuccess; } - return EXIT_FAILURE; + return kErrorInternal; } |
