Commit 98a81ccd authored by Vladimir Serbinenko's avatar Vladimir Serbinenko
Browse files

tape: Allow changing tape prefix

Some games come in several files. Hence additional files need
to be loaded from the same directory when using retroarch.
Allow changing tape prefix
parent 7a6cd1c2
......@@ -570,4 +570,6 @@ static inline enum joystick_state JOYSTICK_BUTTON(int idx) {
void platform_disk_init(disk_t *disks);
extern char * tape_prefix;
#endif
......@@ -7,6 +7,7 @@
unsigned char tape_read_val = 1, tape_write_val = 0;
FILE * tape_read_file = NULL;
FILE * tape_write_file = NULL;
char * tape_prefix = NULL;
unsigned char tape_status = 1; /* 0 = tape moving, 1 = tape stopped */
flag_t fake_tape = 1; /* Default */
......@@ -194,13 +195,24 @@ void fake_read_strobe() {
if (fake_state == Idle && !tape_read_file) {
/* First time here, find which file to open */
get_emt36_filename();
tape_read_file = fopen(unix_filename, "r");
char *alloc_fullpath = NULL;
const char * fullpath = unix_filename;
if (tape_prefix != NULL) {
int al = strlen(unix_filename) + strlen(tape_prefix) + 7;
alloc_fullpath = malloc (al+1);
strncpy(alloc_fullpath, tape_prefix, al);
strncat(alloc_fullpath, unix_filename, al);
fullpath = alloc_fullpath;
}
tape_read_file = fopen(fullpath, "r");
fprintf(stderr, _("Will read unix file <%s> under BK name <%s>\n"),
unix_filename, bk_filename);
fullpath, bk_filename);
fake_state = Addr;
bitnum = 0;
checksum = 0;
curlen = curaddr = 0;
if (alloc_fullpath != NULL)
free (alloc_fullpath);
}
switch (fake_state) {
case Idle:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment