?login_element?

Subversion Repositories NedoOS

Rev

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