This software and its source code (if available) are licensed under the Apache-2.0 license (unless otherwise specified) which DOES NOT APPLY to any third-party code (such as zlib for example) and borrowed Assembler code (ripped code from other software executable files).
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
char *basename(char *s) {
char *r;
if (s) {
for (r = s; *r; r++) {
if ((*r == ':') || (*r == '/') || (*r == '\\')) {
s = &r[1];
}
}
}
return(s);
}
void newext(char *name, char *ext) {
char *p;
if (name && ext) {
for (; (*name == '.'); name++);
for (p = NULL; *name; name++) {
if (*name == '.') {
p = name;
}
}
strcpy(p ? p : name, ext);
}
}
void readdata(FILE *fl, void *data, uint32_t size) {
if (data && size) {
memset(data, 0, size);
if (fl) {
fread(data, size, 1, fl);
}
}
}
static uint8_t t[0xFFFFU + 2];
int main(int argc, char *argv[]) {
uint32_t i, sz;
FILE *fl, *f;
uint16_t w;
char s[260];
printf(
"The Rush: The Veronica Story .BIN to .TXT converter v1.0\n"
"(c) CTPAX-X Team 2026\n"
"http://www.CTPAX-X.org/\n\n"
);
if (argc != 2) {
printf("Usage: bintotxt <filename.bin>\n\n");
return(1);
}
fl = fopen(argv[1], "rb");
if (!fl) {
printf("Error: can't open input file.\n\n");
return(2);
}
strcpy(s, basename(argv[1]));
printf("%s -> ", s);
newext(s, ".txt");
printf("%s\n\n", s);
f = fopen(s, "wb");
if (!f) {
fclose(fl);
printf("Error: can't create output file.\n\n");
return(3);
}
fseek(fl, 0, SEEK_END);
sz = ftell(fl);
fseek(fl, 0, SEEK_SET);
while (ftell(fl) < sz) {
readdata(fl, &w, 2);
readdata(fl, t, w);
/* decrypt strings */
for (i = 0; i < w; i++) {
t[i] = ((t[i] >> 1) | (t[i] << 7)) ^ 0x9E;
}
t[w + 0] = '\r';
t[w + 1] = '\n';
fwrite(t, w + 2, 1, f);
}
fclose(f);
fclose(fl);
printf("\ndone\n\n");
return(0);
}