?login_element?

Subversion Repositories NedoOS

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. #include <iostream>
  2. #include <cstring>
  3. #include <string>
  4. #include <stdio.h>
  5.  
  6. using namespace std;
  7. #define BINARY_FILE 0
  8. #define STARTUP_FILE 1
  9. #define IMAGE_LIST 2
  10. #define MUSIC_LIST 3
  11. #define PALETTE_LIST 4
  12. #define SAMPLE_LIST 5
  13. #define SPRITE_LIST 6
  14. #define SFX_LIST 7
  15. #define SPRTBL_PAGE 8
  16. #define STARTUP_ADR 9
  17. #define STACK_SIZE 10
  18. #define SMP_COUNT 11
  19. #define MUS_COUNT 12
  20. #define MUSLIST_ADR 13
  21. #define SMPLIST_ADR 14
  22. #define SFX_ADR 15
  23. #define PAL_ADR 16
  24. #define IMGLIST_ADR 17
  25. #define TSPR_ADR 18
  26. #define SPRBUF_PAGE 19
  27. #define SPRTBL_PAGE 20
  28. #define SPRTBL_SLOT 21
  29. #define SPRITE_SLOT 22
  30. #define CC_PAGE0 23
  31. #define CC_PAGE1 24
  32. #define CC_PAGE2 25
  33. #define CC_PAGE3 26
  34. #define SND_PAGE 27
  35. #define PAL_PAGE 28
  36. #define GFX_PAGE 29
  37. #define ALT_PAGE_NUMERING 30
  38.  
  39. #define argsCount 31
  40. class ArgsParser {
  41.  
  42. private:
  43.        
  44.         char* val[32];
  45.         int keysCount;
  46.  
  47. public:
  48.         ArgsParser() {
  49.                
  50.                 char* vals[]={  "_temp_\\out.ihx",
  51.                                                 "..\\evosdk\\startup.bin",
  52.                                                 "_temp_\\image.lst",
  53.                                                 "_temp_\\music.lst",
  54.                                                 "_temp_\\palette.lst",
  55.                                                 "_temp_\\sample.lst",
  56.                                                 "_temp_\\sprite.lst",
  57.                                                 "",
  58.                                                 "6","0xe000","0x0400",
  59.                                                 "0x49ff","0x49fe",
  60.                                                 "0x4a00","0x4d00",
  61.                                                 "0x5100","0x0000",
  62.                                                 "0x1000","0xfa00",
  63.                                                 "8","6","0","0",
  64.                                                 "12","13","14",
  65.                                                 "15","0","4","16","0"};
  66.                 for(int a=0;a<argsCount;a++) {
  67.                         val[a]=vals[a];
  68.                 }
  69.         }
  70.  
  71.         void parse(int argc,char* argv[]) {
  72.                 char* key[] = {"BINARY_FILE",
  73.                                                 "STARTUP_FILE",
  74.                                                 "IMAGE_LIST",
  75.                                                 "MUSIC_LIST",
  76.                                                 "PALETTE_LIST",
  77.                                                 "SAMPLE_LIST",
  78.                                                 "SPRITE_LIST",
  79.                                                 "SFX_LIST",
  80.                                                 "SPRTBL_PAGE",
  81.                                                 "STARTUP_ADR",
  82.                                                 "STACK_SIZE",
  83.                                                 "SMP_COUNT",
  84.                                                 "MUS_COUNT",
  85.                                                 "MUSLIST_ADR",
  86.                                                 "SMPLIST_ADR",
  87.                                                 "SFX_ADR",
  88.                                                 "PAL_ADR",
  89.                                                 "IMGLIST_ADR",
  90.                                                 "TSPR_ADR",
  91.                                                 "SPRBUF_PAGE",
  92.                                                 "SPRTBL_PAGE",
  93.                                                 "SPRTBL_SLOT",
  94.                                                 "SPRITE_SLOT",
  95.                                                 "CC_PAGE0",
  96.                                                 "CC_PAGE1",
  97.                                                 "CC_PAGE2",
  98.                                                 "CC_PAGE3",
  99.                                                 "SND_PAGE",
  100.                                                 "PAL_PAGE",
  101.                                                 "GFX_PAGE",
  102.                                                 "ALT_PAGE_NUMERING"
  103.                 };
  104.  
  105.                 keysCount=0;
  106.                 for(int a=0;a<argc;a++) {
  107.                         printf("arg %d = %s\n",a,argv[a]);
  108.                 }
  109.                 for(int a=0;a+1<argc;) {
  110.                         for(int b=0;b<argsCount;b++) {
  111.                                 if(strcmpi(argv[a],key[b])==0) {
  112.                                         val[b]=argv[a+1];
  113.                                         a++;
  114.                                         b=argsCount;
  115.                                 }
  116.                         }
  117.                         a++;
  118.                 }
  119.         }
  120.         char* getArg (int argName) {
  121.                 return val[argName];
  122.         }
  123.         void printHelp() {
  124.                 char* key[] = {"BINARY_FILE",
  125.                                                 "STARTUP_FILE",
  126.                                                 "IMAGE_LIST",
  127.                                                 "MUSIC_LIST",
  128.                                                 "PALETTE_LIST",
  129.                                                 "SAMPLE_LIST",
  130.                                                 "SPRITE_LIST",
  131.                                                 "SFX_LIST",
  132.                                                 "SPRTBL_PAGE",
  133.                                                 "STARTUP_ADR",
  134.                                                 "STACK_SIZE",
  135.                                                 "SMP_COUNT",
  136.                                                 "MUS_COUNT",
  137.                                                 "MUSLIST_ADR",
  138.                                                 "SMPLIST_ADR",
  139.                                                 "SFX_ADR",
  140.                                                 "PAL_ADR",
  141.                                                 "IMGLIST_ADR",
  142.                                                 "TSPR_ADR",
  143.                                                 "SPRBUF_PAGE",
  144.                                                 "SPRTBL_PAGE",
  145.                                                 "SPRTBL_SLOT",
  146.                                                 "SPRITE_SLOT",
  147.                                                 "CC_PAGE0",
  148.                                                 "CC_PAGE1",
  149.                                                 "CC_PAGE2",
  150.                                                 "CC_PAGE3",
  151.                                                 "SND_PAGE",
  152.                                                 "PAL_PAGE",
  153.                                                 "GFX_PAGE",
  154.                                                 "ALT_PAGE_NUMERING"};
  155.                 printf("EVOSDK Resource Compiler by Shiru and Alone Coder 03'12\n");
  156.                 printf("modified by Hippiman 2020\n");
  157.                 printf("Key\t\tDefault Value\n");
  158.                 for(int a=0;a<argsCount;a++) {
  159.                         printf("%s\t\t%s\n",key[a],val[a]);
  160.                 }
  161.         }
  162. };
  163.