/* * b2dlx2b2dlz - b2dlx2b2dlz converter * * Copyright (C) 2015 Excale * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2, as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "p.h" #define xstr(s) str(s) #define str(s) #s int main(int argc, char * argv[]) { FILE * input = NULL; FILE * output = NULL; int r = 0; if (argc != 3) { puts(xstr(OUT)" converter v1.1\n" "Usage: "xstr(OUT)" in.b2dlx out.b2dlz\n"); exit(1); } input = fopen(argv[1], "rb"); if (!input) { perror(argv[1]); exit(1); } output = fopen(argv[2], "wb"); if (!output) { if (input) { fclose(input); } perror(argv[2]); exit(1); } fseek(input, 0, SEEK_END); int nbblocks = ftell(input) >> 3; fseek(input, 0, SEEK_SET); des_initialize(); des_reset(); des_write_word(0x08, 0xFEEDFEED); // 0000C230-0000C278 (Boot Loader Stage 1 (3.00.99) Build: 2010/9/9, 17:29:13) des_write_word(0x0C, 0xFEEDFEED); des_write_word(0x10, 0xFEEDFEED); des_write_word(0x14, 0xFEEDFEED); des_write_word(0x18, 0xFEEDFEED); des_write_word(0x1C, 0xFEEDFEED); u32 xor[2]; xor[0] = 0xFEEDFEED; // [1187EED4] (Boot Loader Stage 2 (3.10.16) Build: 2011/7/6, 14:38:40) xor[1] = 0xFEEDFEED; // [1187EED8] for(int i=0; i