Add prototype for music extraction

This commit is contained in:
octorock
2021-09-16 18:31:51 +02:00
parent 15956402ea
commit bc858317ec
24 changed files with 5948 additions and 10748 deletions
+11 -8
View File
@@ -24,8 +24,10 @@
#include "asm_file.h"
#include "c_file.h"
#include "charmap.h"
#include <algorithm>
Charmap* g_charmap;
std::string g_buildName;
void PrintAsmBytes(unsigned char *s, int length)
{
@@ -132,25 +134,26 @@ char* GetFileExtension(char* filename)
int main(int argc, char **argv)
{
if (argc != 3 && argc != 2)
if (argc != 4 && argc != 3)
{
std::fprintf(stderr, "Usage: %s SRC_FILE CHARMAP_FILE", argv[0]);
std::fprintf(stderr, "Usage: %s BUILD_NAME SRC_FILE CHARMAP_FILE", argv[0]);
return 1;
}
g_charmap = new Charmap(argc == 3 ? argv[2] : "");
g_buildName = std::string(argv[1]);
g_charmap = new Charmap(argc == 4 ? argv[3] : "");
char* extension = GetFileExtension(argv[1]);
char* extension = GetFileExtension(argv[2]);
if (!extension)
FATAL_ERROR("\"%s\" has no file extension.\n", argv[1]);
FATAL_ERROR("\"%s\" has no file extension.\n", argv[2]);
if ((extension[0] == 's') && extension[1] == 0)
PreprocAsmFile(argv[1]);
PreprocAsmFile(argv[2]);
else if ((extension[0] == 'c' || extension[0] == 'i') && extension[1] == 0)
PreprocCFile(argv[1]);
PreprocCFile(argv[2]);
else
FATAL_ERROR("\"%s\" has an unknown file extension of \"%s\".\n", argv[1], extension);
FATAL_ERROR("\"%s\" has an unknown file extension of \"%s\".\n", argv[2], extension);
return 0;
}