summaryrefslogtreecommitdiff
path: root/ToD
diff options
context:
space:
mode:
authorpixel <pixel>2004-11-27 21:44:44 +0000
committerpixel <pixel>2004-11-27 21:44:44 +0000
commitd38e80ee04afe582e70150d3884e56c05f3fd7a8 (patch)
treef2627c50fa22aea89447e8406ac418eb68650d3d /ToD
parent50f0dd331f8168fb5b2cd60c70178fad627b7fb6 (diff)
Large dos2unix commit...
Diffstat (limited to 'ToD')
-rw-r--r--ToD/ExtracteurIdiot.cpp190
-rw-r--r--ToD/c_dumper.cpp280
2 files changed, 235 insertions, 235 deletions
diff --git a/ToD/ExtracteurIdiot.cpp b/ToD/ExtracteurIdiot.cpp
index 8825d97..fde5134 100644
--- a/ToD/ExtracteurIdiot.cpp
+++ b/ToD/ExtracteurIdiot.cpp
@@ -1,96 +1,96 @@
-#include <iostream>
-#include <iomanip>
-#include <fstream>
-#include <vector>
-
-using namespace std;
-
-int main(int, char **)
-{
- int iPosPointeur, iPosTexte;
- char szPath[2][256];
- vector<unsigned char> vFichier;
-
- cout << "Entrez le nom du fichier :";
- cin >> szPath[0];
- cout << "Entrez le nom du fichier texte :";
- cin >> szPath[1];
-
- cout << "Entrez la position du pointeur (Hexadeciaml) :";
- cin >> hex >> iPosPointeur;
- cout << "Entrez la position du texte (Hexadeciaml) :";
- cin >> hex >> iPosTexte;
-
- ifstream ifFichier(szPath[0], ios::binary);
-
- if(ifFichier)
- {
- ifFichier.seekg(0, ios::end);
- vFichier.resize(ifFichier.tellg());
-
- ifFichier.seekg(0, ios::beg);
- ifFichier.read((char *) vFichier.begin(), vFichier.size());
- }
-
- ofstream ofTexte(szPath[1], ios::binary | ios::trunc);
-
- for(int i = 0; i < (iPosTexte - iPosPointeur) / 2; i++)
- {
- ofTexte << "<PT" << setw(4) << setfill('0') << i << ">\n";
-
- for(int j = iPosPointeur + vFichier[iPosPointeur + i * 2] +
- (vFichier[iPosPointeur + i * 2 + 1] * 256); vFichier[j] != 0; j++)
- switch(vFichier[j])
- {
- case 0x01:
- ofTexte << "<NOM:" << (int) vFichier[++j] << ">";
- break;
- case 0x02:
- ofTexte << "<02>";
- break;
- case 0x03:
- ofTexte << "<03>";
- break;
- case 0x04:
- switch (vFichier[++j])
- {
- case 0x02:
- ofTexte << "<VIOLET>";
- break;
- case 0x04:
- ofTexte << "<VERT>";
- break;
- case 0x05:
- ofTexte << "<BLEU>";
- break;
- case 0x06:
- ofTexte << "<JAUNE>";
- break;
- case 0x0F:
- ofText << "<FINCOULEUR>";
- break;
- default:
- ofTexte << setw(2) << << setfill('0') << hex << vFichier[j];
- }
- break;
- case 0x05:
- ofTexte << "<05>";
- break;
- case 0x06:
- ofTexte << "<06>";
- break;
- case 0x0c:
- ofTexte << "<NP>\n";
- break;
- case 0x0a:
- ofTexte.put('\n');
- break;
- default:
- ofTexte.put(vFichier[j]);
- }
-
- ofTexte << "<FIN>\n\n";
- }
-
- return 0;
+#include <iostream>
+#include <iomanip>
+#include <fstream>
+#include <vector>
+
+using namespace std;
+
+int main(int, char **)
+{
+ int iPosPointeur, iPosTexte;
+ char szPath[2][256];
+ vector<unsigned char> vFichier;
+
+ cout << "Entrez le nom du fichier :";
+ cin >> szPath[0];
+ cout << "Entrez le nom du fichier texte :";
+ cin >> szPath[1];
+
+ cout << "Entrez la position du pointeur (Hexadeciaml) :";
+ cin >> hex >> iPosPointeur;
+ cout << "Entrez la position du texte (Hexadeciaml) :";
+ cin >> hex >> iPosTexte;
+
+ ifstream ifFichier(szPath[0], ios::binary);
+
+ if(ifFichier)
+ {
+ ifFichier.seekg(0, ios::end);
+ vFichier.resize(ifFichier.tellg());
+
+ ifFichier.seekg(0, ios::beg);
+ ifFichier.read((char *) vFichier.begin(), vFichier.size());
+ }
+
+ ofstream ofTexte(szPath[1], ios::binary | ios::trunc);
+
+ for(int i = 0; i < (iPosTexte - iPosPointeur) / 2; i++)
+ {
+ ofTexte << "<PT" << setw(4) << setfill('0') << i << ">\n";
+
+ for(int j = iPosPointeur + vFichier[iPosPointeur + i * 2] +
+ (vFichier[iPosPointeur + i * 2 + 1] * 256); vFichier[j] != 0; j++)
+ switch(vFichier[j])
+ {
+ case 0x01:
+ ofTexte << "<NOM:" << (int) vFichier[++j] << ">";
+ break;
+ case 0x02:
+ ofTexte << "<02>";
+ break;
+ case 0x03:
+ ofTexte << "<03>";
+ break;
+ case 0x04:
+ switch (vFichier[++j])
+ {
+ case 0x02:
+ ofTexte << "<VIOLET>";
+ break;
+ case 0x04:
+ ofTexte << "<VERT>";
+ break;
+ case 0x05:
+ ofTexte << "<BLEU>";
+ break;
+ case 0x06:
+ ofTexte << "<JAUNE>";
+ break;
+ case 0x0F:
+ ofText << "<FINCOULEUR>";
+ break;
+ default:
+ ofTexte << setw(2) << << setfill('0') << hex << vFichier[j];
+ }
+ break;
+ case 0x05:
+ ofTexte << "<05>";
+ break;
+ case 0x06:
+ ofTexte << "<06>";
+ break;
+ case 0x0c:
+ ofTexte << "<NP>\n";
+ break;
+ case 0x0a:
+ ofTexte.put('\n');
+ break;
+ default:
+ ofTexte.put(vFichier[j]);
+ }
+
+ ofTexte << "<FIN>\n\n";
+ }
+
+ return 0;
} \ No newline at end of file
diff --git a/ToD/c_dumper.cpp b/ToD/c_dumper.cpp
index 669a564..edbd8df 100644
--- a/ToD/c_dumper.cpp
+++ b/ToD/c_dumper.cpp
@@ -1,140 +1,140 @@
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include "generic.h"
-#include "Main.h"
-#include "Input.h"
-#include "Output.h"
-
-CODE_BEGINS
-int startup() throw (GeneralException)
-{
- long valpos = 0;
- long valpos2 = 0;
- long valposnext = 0;
- long valtaille = 0;
- char doublon[8];
- char doublon2[8];
- unsigned char pos[3];
- unsigned char taille[3];
- int index = 0;
-
- Byte segment[257];
-
- Input * handleindex = new Input("M.B");
- Input * handlearchi = new Input("M.DAT");
-
- while(index!=1315) {
- Output * outfile;
- String nom_fichier;
-
- valposnext = valpos + valtaille;
-
- handleindex->seek(1, SEEK_CUR); // on saute le premier octet
- handleindex->read(pos, 3);
- valpos = pos[0] + (pos[1] << 8) + (pos[2] << 16);
-
- handleindex->seek(1, SEEK_CUR); // on saute le premier octet
- handleindex->read(taille, 3);
- valtaille = taille[0] + (taille[1] << 8) + (taille[2] << 16);
-
- valpos2 = handleindex->tell(); // sauve la position
- doublon[0] = 0;
- doublon[1] = pos[0];
- doublon[2] = pos[1];
- doublon[3] = pos[2];
- doublon[4] = 0;
- doublon[5] = taille[0];
- doublon[6] = taille[1];
- doublon[7] = taille[2]; // on construit la chaine contenant le pointeur
- handleindex->seek(0);
- for(int i = 0; i < (valpos2 - 8); i += 8) {
- handleindex->read(doublon2, 8);
- if(memcmp(doublon, doublon2, 8) == 0) {
- printm(M_BARE, "\nIgnore fichier d'index %d\n", index);
- index++;
- break;
- }
- }
- handleindex->seek(valpos2); // on remet la position au bon endroit
-
- if (memcmp(doublon, doublon2, 8) == 0) {
- continue;
- }
-
- handlearchi->seek(valpos << 8);
-
- nom_fichier.set("extract\\tod_%04d.out", index);
-
- /////////////////////
- // A decommenter si les fichiers sont déjà extrait du .DAT
- /////////////////////
-
- // outfile = fopen(nom_fichier,"rb"); // unarc
-
- ////////////////////
- // Commenter à partir de là jusqu'à la fin du FOR si on a déjà extrait les fichiers du .DAT
- ////////////////////
-
- outfile = new Output(nom_fichier);
-
- for (int i = 0; i < valtaille; i++) {
- handlearchi->read(segment, 256);
- outfile->write(segment, 256);
- }
- ////////////////////
-
- printm(M_BARE, "\rFichier dumpé : %d",index);
- //unarc(outfile,index);
- delete outfile;
- index++;
-
- }
- delete handleindex;
- delete handlearchi;
-
- printm(M_BARE, "\nNombre de fichiers dumpés : %d",index - 1);
- return 0;
-}
-
-void unarc(Input * fichier, int num)
-{
- int quantite;
- int *pos;
- long taille;
- char *buf;
- String nomarchive;
- String nomfichier;
- Output *fichierout;
-
- taille = fichier->GetSize();
-
- fichier->read(&quantite, 4);
- pos = (int *) malloc(4 * quantite);
- fichier->read(pos, 4 * quantite);
- nomarchive.set("%04d", num);
- MKDIR(nomarchive.to_charp());
-
- for (int i = 0; i < quantite - 1; i++) {
- buf=(char *) malloc(pos[i+1]-pos[i]);
- fichier->read(buf, pos[i + 1] - pos[i]);
- nomarchive.set("%04d", i);
-
- fichierout = new Output(nomarchive + nomfichier);
- fichierout->write(buf, pos[i + 1] - pos[i]);
- delete fichierout;
- }
-
- buf = (char *) malloc(taille - pos[quantite - 1]);
- fichier->read(buf, taille - pos[quantite - 1]);
- nomfichier.set("%04d", quantite - 1);
-
- fichierout = new Output(nomarchive + nomfichier);
- fichierout->write(buf, taille - pos[quantite - 1]);
- delete fichierout;
-}
-
-int Analyse_table() {
- return 1;
-}
-CODE_ENDS
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include "generic.h"
+#include "Main.h"
+#include "Input.h"
+#include "Output.h"
+
+CODE_BEGINS
+int startup() throw (GeneralException)
+{
+ long valpos = 0;
+ long valpos2 = 0;
+ long valposnext = 0;
+ long valtaille = 0;
+ char doublon[8];
+ char doublon2[8];
+ unsigned char pos[3];
+ unsigned char taille[3];
+ int index = 0;
+
+ Byte segment[257];
+
+ Input * handleindex = new Input("M.B");
+ Input * handlearchi = new Input("M.DAT");
+
+ while(index!=1315) {
+ Output * outfile;
+ String nom_fichier;
+
+ valposnext = valpos + valtaille;
+
+ handleindex->seek(1, SEEK_CUR); // on saute le premier octet
+ handleindex->read(pos, 3);
+ valpos = pos[0] + (pos[1] << 8) + (pos[2] << 16);
+
+ handleindex->seek(1, SEEK_CUR); // on saute le premier octet
+ handleindex->read(taille, 3);
+ valtaille = taille[0] + (taille[1] << 8) + (taille[2] << 16);
+
+ valpos2 = handleindex->tell(); // sauve la position
+ doublon[0] = 0;
+ doublon[1] = pos[0];
+ doublon[2] = pos[1];
+ doublon[3] = pos[2];
+ doublon[4] = 0;
+ doublon[5] = taille[0];
+ doublon[6] = taille[1];
+ doublon[7] = taille[2]; // on construit la chaine contenant le pointeur
+ handleindex->seek(0);
+ for(int i = 0; i < (valpos2 - 8); i += 8) {
+ handleindex->read(doublon2, 8);
+ if(memcmp(doublon, doublon2, 8) == 0) {
+ printm(M_BARE, "\nIgnore fichier d'index %d\n", index);
+ index++;
+ break;
+ }
+ }
+ handleindex->seek(valpos2); // on remet la position au bon endroit
+
+ if (memcmp(doublon, doublon2, 8) == 0) {
+ continue;
+ }
+
+ handlearchi->seek(valpos << 8);
+
+ nom_fichier.set("extract\\tod_%04d.out", index);
+
+ /////////////////////
+ // A decommenter si les fichiers sont déjà extrait du .DAT
+ /////////////////////
+
+ // outfile = fopen(nom_fichier,"rb"); // unarc
+
+ ////////////////////
+ // Commenter à partir de là jusqu'à la fin du FOR si on a déjà extrait les fichiers du .DAT
+ ////////////////////
+
+ outfile = new Output(nom_fichier);
+
+ for (int i = 0; i < valtaille; i++) {
+ handlearchi->read(segment, 256);
+ outfile->write(segment, 256);
+ }
+ ////////////////////
+
+ printm(M_BARE, "\rFichier dumpé : %d",index);
+ //unarc(outfile,index);
+ delete outfile;
+ index++;
+
+ }
+ delete handleindex;
+ delete handlearchi;
+
+ printm(M_BARE, "\nNombre de fichiers dumpés : %d",index - 1);
+ return 0;
+}
+
+void unarc(Input * fichier, int num)
+{
+ int quantite;
+ int *pos;
+ long taille;
+ char *buf;
+ String nomarchive;
+ String nomfichier;
+ Output *fichierout;
+
+ taille = fichier->GetSize();
+
+ fichier->read(&quantite, 4);
+ pos = (int *) malloc(4 * quantite);
+ fichier->read(pos, 4 * quantite);
+ nomarchive.set("%04d", num);
+ MKDIR(nomarchive.to_charp());
+
+ for (int i = 0; i < quantite - 1; i++) {
+ buf=(char *) malloc(pos[i+1]-pos[i]);
+ fichier->read(buf, pos[i + 1] - pos[i]);
+ nomarchive.set("%04d", i);
+
+ fichierout = new Output(nomarchive + nomfichier);
+ fichierout->write(buf, pos[i + 1] - pos[i]);
+ delete fichierout;
+ }
+
+ buf = (char *) malloc(taille - pos[quantite - 1]);
+ fichier->read(buf, taille - pos[quantite - 1]);
+ nomfichier.set("%04d", quantite - 1);
+
+ fichierout = new Output(nomarchive + nomfichier);
+ fichierout->write(buf, taille - pos[quantite - 1]);
+ delete fichierout;
+}
+
+int Analyse_table() {
+ return 1;
+}
+CODE_ENDS