// ATENCIÓ! Este programa no fa ninguna gestió de errors. Si no troba els arxius on els espera, peta i au. Es una xicoteta ferramenta #include #include #include #include #define NUM_RESOURCES 8 #define DIAPO_ESPERAR 0 #define DIAPO_FADEIN 1 #define DIAPO_SHOW 2 #define DIAPO_PRINT 3 #define DIAPO_MUSICA 4 #define DIAPO_FADEOUT 5 #define DIAPO_FADEMUSIC 6 const char *resources[NUM_RESOURCES] = { "../data/seqIN.seq", "../data/seq00.seq", "../data/seq05.seq", "../data/seq10.seq", "../data/seq15.seq", "../data/seq20.seq", "../data/seq25.seq", "../data/seq30.seq" }; char *p = nullptr; uint8_t getByte() { return *(p++); } uint16_t getWord() { return getByte() + (getByte() << 8); } std::string getString() { uint8_t tamanyCadena = getByte(); char filename[256]; for (int i=0; i0) { const char tipo_diapositiva = getByte(); switch ( tipo_diapositiva ) { case DIAPO_ESPERAR: { const uint16_t time = getWord(); fprintf(fp, "ESPERAR %i\n", time); break; } case DIAPO_FADEIN: { std::string filename = getString(); fprintf(fp, "FADEIN '%s'\n", filename.c_str()); break; } case DIAPO_SHOW: { std::string filename = getString(); fprintf(fp, "SHOW '%s'\n", filename.c_str()); break; } case DIAPO_PRINT: { const uint16_t x = getWord(); const uint16_t y = getWord(); const uint8_t col = getByte(); std::string text = getString(); fprintf(fp, "PRINT %i %i %i '%s'\n", x, y, col, text.c_str()); break; } case DIAPO_MUSICA: { std::string filename = getString(); fprintf(fp, "PLAYMUSIC '%s'\n", filename.c_str()); break; } case DIAPO_FADEOUT: { fprintf(fp, "FADEOUT\n"); break; } case DIAPO_FADEMUSIC: fprintf(fp, "FADEOUTMUSIC\n"); break; } num_diapositives--; } fclose(fp); free(buffer); } }