oplplayer/bankconv.c

41 lines
880 B
C
Raw Normal View History

2025-03-20 11:02:57 +01:00
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdarg.h>
#include <errno.h>
#include "strings.h"
#include "dmx.h"
#define ARGPARSE_DE
#include "../argparse.h"
int main(int argc, char **argv) {
char *dmxname = NULL;
char *drumname = NULL;
char *skbname = NULL;
int32_t usedrum = 0;
argp_t *argspec = arg_alloc(4);
arg_add_nstr(argspec, STR_ARGS_BANK, true, &dmxname);
arg_add_nstr(argspec, STR_ARGS_SKB, true, &skbname);
arg_add_str(argspec, 'q', STR_ARGS_DBANK, &drumname);
arg_add_bool(argspec, 'Q', STR_ARGS_USEDRM, &usedrum);
if(arg_parse(argspec, argc, argv) ^ 1) {
return 1;
}
bank_instr *instr = bnk_read_banks(dmxname, drumname, usedrum);
if(instr == NULL) {
return 1;
}
if(skb_write_bank(instr, skbname) ^ 1) {
free(instr);
return 1;
}
free(instr);
return 0;
}