Convert old MexScript to BMSScript ?
-
- Site Admin
- Posts: 12984
- Joined: Wed Jul 30, 2014 9:32 pm
Re: Convert old MexScript to BMSScript ?
No idea, maybe they are sprites or something like that... not my field
-
- Posts: 81
- Joined: Mon Apr 01, 2019 10:49 am
Re: Convert old MexScript to BMSScript ?
No problem
Here a C code i have adapted to work to extract every voices from Dune (Mega CD Version).
But it just make a full WAV file and not cut every voices one by one (like a BMS Script do)
Theses Voices (after the C Script) are :
Encoding: Unsigned 8-bit PCM
Bytes order : "Endianness"
22222Hz Mono
Are you sure Dune Mega CD have no header ? It can helps us, because it's really painful to cut every voices in my export xD.
We have everything thanks to this C code, but really really long to cut every voices one by one
Dune Mega CD : https://we.tl/t-AC7iGRP2Ew
Here a C code i have adapted to work to extract every voices from Dune (Mega CD Version).
Code: Select all
#include "stdio.h"
int ConvertToWav()
{
FILE *file, *wav;
int read = EOF, write, i = 0;
int wavheader[] = {
0x52, 0x49, 0x46, 0x46, 0x04, 0x09, 0x42, 0x13, 0x57, 0x41,
0x56, 0x45, 0x66, 0x6D, 0x74, 0x20, 0x10, 0x00, 0x00, 0x00,
0x01, 0x00, 0x01, 0x00, 0xCE, 0x56, 0x00, 0x00, 0x9C, 0xAD,
0x00, 0x00, 0x02, 0x00, 0x10, 0x00, 0x64, 0x61, 0x74, 0x61,
0xE0, 0x08, 0x42, 0x13, 0x00
};
printf("Dune PCM Dumper to Wav Converted Modified by Tgames V1.0\n");
file = fopen("DUNE.DAT", "r");
if(!file)
{
printf("Could not open DUNE.DAT, please copy it in this folder and restart\n");
return(0);
}
wav = fopen("DUNEMGCD_PCM.wav", "w");
if(!wav)
{
fclose(file);
printf("Could not create output file\n");
return(0);
}
do
{
write = wavheader[i++];
if(write != 0xFF)
fputc(write, wav);
}
while(write != 0xFF);
printf("Writing to DUNEMGCD_PCM.wav\n");
do
{
read = fgetc(file);
if(read != EOF)
{
if(read < 0x80)
write = 0x80 - read;
else
write = read;
if(write == 0xFF)
{
int skip = 0;
do
{
read = fgetc(file);
skip ++;
}
while(skip < 12 && read != EOF);
}
else
fputc(write, wav);
}
}
while(read != EOF);
fclose(wav);
fclose(file);
printf("Conversion complete\n");
return(1);
}
int main()
{
if(!ConvertToWav())
return(1);
return(0);
}
But it just make a full WAV file and not cut every voices one by one (like a BMS Script do)
Theses Voices (after the C Script) are :
Encoding: Unsigned 8-bit PCM
Bytes order : "Endianness"
22222Hz Mono
Are you sure Dune Mega CD have no header ? It can helps us, because it's really painful to cut every voices in my export xD.
We have everything thanks to this C code, but really really long to cut every voices one by one
Dune Mega CD : https://we.tl/t-AC7iGRP2Ew
-
- Site Admin
- Posts: 12984
- Joined: Wed Jul 30, 2014 9:32 pm
Re: Convert old MexScript to BMSScript ?
There are only zeroes at the beginning and 'P's at the end.
No structure.
No structure.
-
- Posts: 81
- Joined: Mon Apr 01, 2019 10:49 am
Re: Convert old MexScript to BMSScript ?
Arf bad
And in my export, can a BMS Script auto split each voices ?
Here is my full export of all voices :
https://we.tl/t-Fq7MHjODmG
There is a separator sound between each voices.
And in my export, can a BMS Script auto split each voices ?
Here is my full export of all voices :
https://we.tl/t-Fq7MHjODmG
There is a separator sound between each voices.
-
- Site Admin
- Posts: 12984
- Joined: Wed Jul 30, 2014 9:32 pm
Re: Convert old MexScript to BMSScript ?
Those separators you see are the 'P's I said before.
Every file is aligned to 2048 bytes and the 'P's are used for padding.
The index file contains both offsets and sizes, without them it's just a waste of time.
You can use this script on DUNE.DAT and it will use the 'P's for dumping the files separately:
Every file is aligned to 2048 bytes and the 'P's are used for padding.
The index file contains both offsets and sizes, without them it's just a waste of time.
You can use this script on DUNE.DAT and it will use the 'P's for dumping the files separately:
Code: Select all
for
savepos OFFSET
findloc EOF binary "PPPPPPPP"
if OFFSET == EOF
break
endif
math SIZE = EOF
math SIZE - OFFSET
log "" OFFSET SIZE
math EOF x 0x800
goto EOF
next
-
- Posts: 81
- Joined: Mon Apr 01, 2019 10:49 am
Re: Convert old MexScript to BMSScript ?
Thanks for the script !
It's possible to include the convert of each files generated or i can just convert them with the C code ?
Best Regards.
It's possible to include the convert of each files generated or i can just convert them with the C code ?
Best Regards.
-
- Site Admin
- Posts: 12984
- Joined: Wed Jul 30, 2014 9:32 pm
Re: Convert old MexScript to BMSScript ?
I think it's more easy if you use that tool, once the files are extracted you can mass converting them on the fly.
-
- Site Admin
- Posts: 12984
- Joined: Wed Jul 30, 2014 9:32 pm
Re: Convert old MexScript to BMSScript ?
Obviously that C code needs some edits, the filename for sure.
I also suggest EVER to use "wb" instead "w" with fopen.
I also suggest EVER to use "wb" instead "w" with fopen.
-
- Posts: 81
- Joined: Mon Apr 01, 2019 10:49 am
Re: Convert old MexScript to BMSScript ?
Thanks for all your answers
Can you write what i need to change on the C code (if you can, otherwhise i will search myself don't worry).
Can you write what i need to change on the C code (if you can, otherwhise i will search myself don't worry).
-
- Site Admin
- Posts: 12984
- Joined: Wed Jul 30, 2014 9:32 pm
Re: Convert old MexScript to BMSScript ?
That C code is super bugged
-
- Site Admin
- Posts: 12984
- Joined: Wed Jul 30, 2014 9:32 pm
Re: Convert old MexScript to BMSScript ?
Really it doesn't work at all.
The result is garbage.
The result is garbage.
-
- Posts: 706
- Joined: Fri Aug 08, 2014 1:06 am
Re: Convert old MexScript to BMSScript ?
Tgames wrote:Thanks for the fix for the first script...
um, you're welcome?
the spiderman mexscript was also incomplete...
-
- Posts: 81
- Joined: Mon Apr 01, 2019 10:49 am
Re: Convert old MexScript to BMSScript ?
I used this code to convert the audio to something readable aLuigi :
http://junkerhq.net/Snatcher/PCM2WAV/
Thanks Acewell for the Spider Man Extract code but i got an error when trying to extract a package :/
http://junkerhq.net/Snatcher/PCM2WAV/
Thanks Acewell for the Spider Man Extract code but i got an error when trying to extract a package :/
-
- Site Admin
- Posts: 12984
- Joined: Wed Jul 30, 2014 9:32 pm
Re: Convert old MexScript to BMSScript ?
Something readable? I hear only noise which means that it uses a specific codec and the trick used in that C code doesn't work.
Anyway the following is the script, once you have the codec code it's easy to put it in the convert() function:
Anyway the following is the script, once you have the codec code it's easy to put it in the convert() function:
Code: Select all
set MEMORY_FILE10 string "
int convert(unsigned char *data, int size, unsigned char *wav) {
int read, write, i = 0, x = 0;
while(i < size) {
read = data[i++];
{
if(read < 0x80)
write = 0x80 - read;
else
write = read;
if(write == 0xFF)
{
i += 12;
}
else
wav[x++] = write;
}
}
return x;
}
"
for i = 0
savepos OFFSET
findloc EOF binary "PPPPPPPP"
if OFFSET == EOF
break
endif
math SIZE = EOF
math SIZE - OFFSET
string NAME p "%d.wav" i
#log NAME OFFSET SIZE
callfunction DUMP
math EOF x 0x800
goto EOF
next i
startfunction DUMP
log MEMORY_FILE2 0 0
putvarchr MEMORY_FILE2 SIZE 0
log MEMORY_FILE OFFSET SIZE
calldll MEMORY_FILE10 "convert" "tcc" SIZE MEMORY_FILE SIZE MEMORY_FILE2
math CODEC = 1
math BITS = 16
math CHANNELS = 1
math FREQUENCY = 22050
math BLKALIGN = BITS
math BLKALIGN / 8
math BLKALIGN * CHANNELS
math AVGBYTES = FREQUENCY
math AVGBYTES * BLKALIGN
log MEMORY_FILE 0 0
putdstring "RIFF" 4 MEMORY_FILE
put 0 long MEMORY_FILE
putdstring "WAVE" 4 MEMORY_FILE
# "fmt "
putdstring "fmt " 4 MEMORY_FILE
put 0 long MEMORY_FILE
put CODEC short MEMORY_FILE # wFormatTag: Microsoft PCM Format (0x0001)
put CHANNELS short MEMORY_FILE # wChannels
put FREQUENCY long MEMORY_FILE # dwSamplesPerSec
put AVGBYTES long MEMORY_FILE # dwAvgBytesPerSec
put BLKALIGN short MEMORY_FILE # wBlockAlign
put BITS short MEMORY_FILE # wBitsPerSample
get MEM_SIZE asize MEMORY_FILE
math RIFFTMP = MEM_SIZE
math RIFFTMP - 0x14
putvarchr MEMORY_FILE 0x10 RIFFTMP long
# "data"
putdstring "data" 4 MEMORY_FILE
put SIZE long MEMORY_FILE
get MEM_SIZE asize MEMORY_FILE
math RIFFTMP = SIZE
math RIFFTMP + MEM_SIZE
math RIFFTMP - 8
putvarchr MEMORY_FILE 4 RIFFTMP long
log NAME 0 MEM_SIZE MEMORY_FILE
append
log NAME 0 SIZE MEMORY_FILE2
append
endfunction
-
- Posts: 81
- Joined: Mon Apr 01, 2019 10:49 am
Re: Convert old MexScript to BMSScript ?
This is the original code of the PCM Extractor tool :
http://junkerhq.net/Snatcher/PCM2WAV/Sn ... CM2WAV.zip
1) Just rename any .meg to « PCMLD_01.BIN »
2) Throw this file into spcm2wav.exe
3) It will generate a file « Snatcher_PCM.wav »
4) Open this file with Audacity in « Raw Mode »
5) Set values to :
Encoding: Unsigned 8-bit PCM
Bytes order : "big endian"
22222Hz Mono
6) That’s all, the audio is correct, just remove 1 second at the beginning
7) It can be exported to WAV
But Indeed the original source code seems a bit buggy !
By following theses step it's work on each files but indeed the code is buggy :/
Thanks a lot for the script !
But it's seems to do nothing on .meg files.
http://junkerhq.net/Snatcher/PCM2WAV/Sn ... CM2WAV.zip
1) Just rename any .meg to « PCMLD_01.BIN »
2) Throw this file into spcm2wav.exe
3) It will generate a file « Snatcher_PCM.wav »
4) Open this file with Audacity in « Raw Mode »
5) Set values to :
Encoding: Unsigned 8-bit PCM
Bytes order : "big endian"
22222Hz Mono
6) That’s all, the audio is correct, just remove 1 second at the beginning
7) It can be exported to WAV
But Indeed the original source code seems a bit buggy !
By following theses step it's work on each files but indeed the code is buggy :/
Thanks a lot for the script !
But it's seems to do nothing on .meg files.
-
- Posts: 81
- Joined: Mon Apr 01, 2019 10:49 am
Re: Convert old MexScript to BMSScript ?
The correct values for all .meg (after conversion) are :
Encoding: Unsigned 8-bit PCM
Bytes order : "big endian"
22222Hz Mono
Encoding: Unsigned 8-bit PCM
Bytes order : "big endian"
22222Hz Mono
-
- Posts: 81
- Joined: Mon Apr 01, 2019 10:49 am
Re: Convert old MexScript to BMSScript ?
Here is a english sample converted to .VOC with correct values taken from the Mega CD version :
https://we.tl/t-gLY8d05ks0
All voices are in the same values :
Encoding: Unsigned 8-bit PCM
Bytes order : "big endian"
22222Hz Mono
https://we.tl/t-gLY8d05ks0
All voices are in the same values :
Encoding: Unsigned 8-bit PCM
Bytes order : "big endian"
22222Hz Mono
-
- Site Admin
- Posts: 12984
- Joined: Wed Jul 30, 2014 9:32 pm
Re: Convert old MexScript to BMSScript ?
endianess doesn't exist in 8bits, frequency is 22050 as stated in the script (why it should be 22222???).
For setting 8 bits it's enough to use BITS = 8 in the script where it's currently 16
Those audio files are "Megative Voice File" while the others are different things.
For setting 8 bits it's enough to use BITS = 8 in the script where it's currently 16
Those audio files are "Megative Voice File" while the others are different things.
-
- Posts: 81
- Joined: Mon Apr 01, 2019 10:49 am
Re: Convert old MexScript to BMSScript ?
It's big endian.
I badly translated to english "Gros boutisme" in french ^^
It's really 22222hz ! We are sure about that, because in all Dune port it's 22222hz.
And we have a 1:1 comparaison between english voices from the Mega CD and PC in 22222hz it's totally identical.
I badly translated to english "Gros boutisme" in french ^^
It's really 22222hz ! We are sure about that, because in all Dune port it's 22222hz.
And we have a 1:1 comparaison between english voices from the Mega CD and PC in 22222hz it's totally identical.
-
- Site Admin
- Posts: 12984
- Joined: Wed Jul 30, 2014 9:32 pm
Re: Convert old MexScript to BMSScript ?
Interesting that thing of the sample rate, developers are crazy
Now the main question remains: we have DUNE.DAT but where are the other files and executables that contain the index?
Now the main question remains: we have DUNE.DAT but where are the other files and executables that contain the index?