comparison util.c @ 1103:22e87b739ad6

WIP split of ROM loading/argument parsing from Genesis emulation code. Compiles and doesn't crash, but nothing works. Still a few too many globals as well.
author Michael Pavone <pavone@retrodev.com>
date Fri, 09 Dec 2016 09:48:48 -0800
parents 266dc3f31f35
children 160e3f597cec
comparison
equal deleted inserted replaced
1102:c15896605bf2 1103:22e87b739ad6
54 for (int i = 0; i < num_parts; i++) { 54 for (int i = 0; i < num_parts; i++) {
55 strcat(ret, parts[i]); 55 strcat(ret, parts[i]);
56 } 56 }
57 return ret; 57 return ret;
58 } 58 }
59
60 void byteswap_rom(int filesize, uint16_t *cart)
61 {
62 for(uint16_t *cur = cart; cur - cart < filesize/2; ++cur)
63 {
64 *cur = (*cur >> 8) | (*cur << 8);
65 }
66 }
67
59 68
60 long file_size(FILE * f) 69 long file_size(FILE * f)
61 { 70 {
62 fseek(f, 0, SEEK_END); 71 fseek(f, 0, SEEK_END);
63 long fsize = ftell(f); 72 long fsize = ftell(f);