support for mono "bmdx" files added

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@560 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
manakoAT 2009-01-10 22:39:43 +00:00
parent fd6ca93047
commit cfae8db6d8
6 changed files with 148 additions and 143 deletions

View File

@ -1,55 +0,0 @@
Attribute VB_Name = "Modul1"
Sub ValueChange(Ctrl As Control, ByVal V, ByVal MaxV, ByVal Farbe)
Vertikal = (Ctrl.ScaleWidth <= Ctrl.ScaleHeight)
If Vertikal Then
W = Ctrl.ScaleHeight
TW = Ctrl.TextWidth("100")
If Ctrl.Width < TW Then Ctrl.Width = TW
Else
W = Ctrl.ScaleWidth
End If
Xw = (Abs(V) / Abs(MaxV)) * W
Proz$ = LTrim$(Str$(Int((Xw / W) * 100)))
T$ = "%"
F = Farbe
DM = 14
Select Case F
Case 7, 10, 11, 13, 14
F = 0
DM = 9
Case 15
F = 0
DM = 6
End Select
Ctrl.DrawMode = DM
Ctrl.ForeColor = QBColor(F)
Ctrl.AutoRedraw = True
Ctrl.Cls
Select Case Vertikal
Case 0
Ctrl.CurrentX = (W - Ctrl.TextWidth(Proz$ + "%")) \ 2
Ctrl.Print Proz$ + T$;
Case -1
Ctrl.CurrentX = (Ctrl.ScaleWidth - Ctrl.TextWidth(Proz$)) \ 2
Ctrl.CurrentY = (Ctrl.ScaleHeight - 2 * Ctrl.TextHeight(Proz$)) \ 2
Ctrl.Print Proz$;
Ctrl.CurrentX = (Ctrl.ScaleWidth - Ctrl.TextWidth("%")) \ 2
Ctrl.CurrentY = (Ctrl.ScaleHeight - (Ctrl.TextHeight(Proz$)) \ 2) \ 2
Ctrl.Print "%";
End Select
If V > 0 Then
Select Case Vertikal
Case 0
Ctrl.Line (0, 0)-(Xw, Ctrl.ScaleHeight), QBColor(Farbe), BF
Case -1
Ctrl.Line (0, Ctrl.ScaleHeight - Xw)-(Ctrl.ScaleWidth, Ctrl.ScaleHeight), QBColor(Farbe), BF
End Select
End If
Ctrl.AutoRedraw = False
End Sub

View File

@ -1750,6 +1750,8 @@ Dim TimeSecondsCutLoopEnd
Dim MSADPCM_Frames Dim MSADPCM_Frames
Dim MSADPCM_LastFrame Dim MSADPCM_LastFrame
Dim RiffChannels As Integer
Dim RiffBits As Integer
'setting up needed GENH variables (ordered - all are 4 bytes long) 'setting up needed GENH variables (ordered - all are 4 bytes long)
Dim strGENHCheck As String * 4 Dim strGENHCheck As String * 4
@ -2174,6 +2176,68 @@ COUNTER = 0
End Sub End Sub
Private Sub cmdFindLoopsPSX_Click()
Close #1
Dim CheckByte As Byte
COUNTER = 0
If strInputFile = "" Then
lblINFO.Caption = ("No File selected!")
Exit Sub
ElseIf txtGENHChannels.Text = "" Then
lblINFO.Caption = ("Channel Value not set!")
Exit Sub
End If
GENHChannels = txtGENHChannels.Text
Open strInputFile For Binary As #1
Do
Get #1, 2 + COUNTER, CheckByte
If CheckByte = 0 Then
lblINFO.Caption = "File has no Loop Flages, using standard values...!"
txtGENHLoopStartSamples.Text = ""
cmdUSEFILEEND_Click
Close #1
Exit Sub
End If
If CheckByte = 6 Then
txtGENHLoopStartSamples.Text = COUNTER / 16 / GENHChannels * 28
lblINFO.Caption = "Loop Start found (" & txtGENHLoopStartSamples.Text & ")"
End If
COUNTER = COUNTER + 16
Loop Until CheckByte = 6
COUNTER = 0
Do
Get #1, (FileLen(strInputFile) - 14) - COUNTER, CheckByte
If COUNTER = &H20000 Then
Close #1
Exit Sub
End If
If CheckByte = 3 Then
txtGENHLoopEndSamples.Text = (FileLen(strInputFile) - COUNTER) / 16 / GENHChannels * 28
lblINFO.Caption = "Loop End found (" & txtGENHLoopEndSamples.Text & ")"
End If
COUNTER = COUNTER + 16
Loop Until CheckByte = 3
Close #2
End Sub
Private Sub cmdUSEFILEEND_Click() Private Sub cmdUSEFILEEND_Click()
Close #1 Close #1
@ -2403,19 +2467,24 @@ End Sub
Private Sub File1_Click() Private Sub File1_Click()
Close #1 'Just to be sure, to prevent crashes
If FolderBrowser1.Text = "" Then If FolderBrowser1.Text = "" Then
txtInputFile.Text = File1.FileName txtInputFile.Text = File1.FileName
Else Else
txtInputFile.Text = FolderBrowser1.Text & "\" & File1.FileName txtInputFile.Text = FolderBrowser1.Text & "\" & File1.FileName
End If End If
strInputFile = txtInputFile.Text strInputFile = txtInputFile.Text
txtInputFileLength.Text = (FileLen(strInputFile))
txtInputFileLength.Text = (FileLen(strInputFile)) txtOutputFile.Text = txtInputFile.Text & ".GENH"
txtOutputFile.Text = txtInputFile.Text & ".GENH"
Open strInputFile For Binary As #1 Open strInputFile For Binary As #1
'##############################################################################
'#### Here we'll implement some checks and autogetting for varoius formats ####
'##############################################################################
'"GENH" - the creator will be disabled if you select a "GENH" file
Get #1, 1, strGENHCheck Get #1, 1, strGENHCheck
If strGENHCheck = "GENH" Then If strGENHCheck = "GENH" Then
txtOutputFile.Text = "" txtOutputFile.Text = ""
@ -2424,39 +2493,77 @@ Private Sub File1_Click()
Close #1 Close #1
Exit Sub Exit Sub
Else Else
'Else, we'll remove the extension for further things
cmdCreateGENH.Enabled = True cmdCreateGENH.Enabled = True
lblCreateGenh.Enabled = True lblCreateGenh.Enabled = True
On Error Resume Next
On Error Resume Next NAMECUT = txtInputFile.Text
NAMECUT = txtInputFile.Text txtOutputFile.Text = Left(NAMECUT, InStrRev(txtInputFile.Text, ".") - 1) & ".GENH"
txtOutputFile.Text = Left(NAMECUT, InStrRev(txtInputFile.Text, ".") - 1) & ".GENH" txtGetFileName.Text = File1.FileName
txtGetFileName.Text = File1.FileName
End If End If
If strGENHCheck = "SPSD" Then 'NAOMI / NAOMI 2 'SPSD - found in various NAOMI/NAOMI2 and DreamCast games
If strGENHCheck = "SPSD" Then 'NAOMI / NAOMI 2
Get #1, 13, GENHLoopEnd Get #1, 13, GENHLoopEnd
Get #1, 45, GENHLoopStart Get #1, 45, GENHLoopStart
If GENHLoopStart > GENHLoopEnd Then If GENHLoopStart > GENHLoopEnd Then
GENHLoopStart = -1 GENHLoopStart = -1
Else Else
GENHLoopStart = GENHLoopStart GENHLoopStart = GENHLoopStart
End If End If
comboFileFormat.ListIndex = 10 comboFileFormat.ListIndex = 10 'Yamaha ADPCM
txtGENHHeaderSkip.Text = "64" txtGENHHeaderSkip.Text = "64"
txtGENHLoopEndSamples.Text = GENHLoopEnd txtGENHLoopEndSamples.Text = GENHLoopEnd
txtGENHLoopStartSamples.Text = GENHLoopStart txtGENHLoopStartSamples.Text = GENHLoopStart
If chkHalfFileInterleave.Value = 1 Then If chkHalfFileInterleave.Value = 1 Then
GENHInterleave = GENHLoopEnd / 2 GENHInterleave = GENHLoopEnd / 2
End If
End If End If
End If
'Riff WAVEfmt - no need to explain this...
If strGENHCheck = "RIFF" Then
Get #1, 9, strGENHCheck
If strGENHCheck = "WAVE" Then
Get #1, 13, strGENHCheck
If strGENHCheck = "fmt " Then
Get #1, 23, RiffChannels
Get #1, 25, GENHFrequency
Get #1, 35, RiffBits
COUNTER = 0
Do
Get #1, 1 + COUNTER, strGENHCheck
If strGENHCheck = "data" Then
Get #1, COUNTER + 5, GENHLoopEnd
If RiffBits = 8 Then
txtGENHLoopEndSamples = GENHLoopEnd / RiffChannels
txtGENHHeaderSkip.Text = COUNTER + 8
txtGENHChannels.Text = RiffChannels
txtGENHFrequency.Text = GENHFrequency
ElseIf RiffBits = 16 Then
txtGENHLoopEndSamples = GENHLoopEnd / RiffChannels / 2
txtGENHHeaderSkip.Text = COUNTER + 8
txtGENHChannels.Text = RiffChannels
txtGENHFrequency.Text = GENHFrequency
End If
End If
COUNTER = COUNTER + 1
Loop Until COUNTER = 2048
End If
End If
End If
Close #1 Close #1
frmFileCreator.Caption = "File: " & strInputFile frmFileCreator.Caption = "File: " & strInputFile

View File

@ -1,50 +0,0 @@
VERSION 5.00
Begin VB.Form Form2
Caption = "Form2"
ClientHeight = 3090
ClientLeft = 60
ClientTop = 450
ClientWidth = 6195
LinkTopic = "Form2"
ScaleHeight = 3090
ScaleWidth = 6195
StartUpPosition = 3 'Windows-Standard
Begin VB.CommandButton Command1
Caption = "Start"
Height = 375
Left = 1440
TabIndex = 1
Top = 1560
Width = 3135
End
Begin VB.TextBox Text1
Alignment = 2 'Zentriert
Height = 285
IMEMode = 3 'DISABLE
Left = 1440
PasswordChar = "*"
TabIndex = 0
Top = 1200
Width = 3135
End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
If Text1.Text = "burnout" Then
Unload Form2
Form1.Show
Else:
MsgBox ("Wrong password, cya :P")
Unload Form2
Unload Form1
End If
End Sub

View File

@ -3,7 +3,6 @@ Form=Form1.frm
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINDOWS\system32\stdole2.tlb#OLE Automation Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINDOWS\system32\stdole2.tlb#OLE Automation
Object={49CBE90A-5F9F-4127-919C-0B74E18CB87E}#1.0#0; CK-Tools.ocx Object={49CBE90A-5F9F-4127-919C-0B74E18CB87E}#1.0#0; CK-Tools.ocx
Form=frmABOUT.frm Form=frmABOUT.frm
Form=Form2.frm
IconForm="Form1" IconForm="Form1"
Startup="Form1" Startup="Form1"
HelpFile="" HelpFile=""

View File

@ -1,3 +1,2 @@
Form1 = 0, 0, 601, 456, Z, 22, 29, 623, 485, C Form1 = 0, 0, 601, 456, Z, 22, 29, 623, 485, C
frmABOUT = 0, 0, 0, 0, C, 132, 174, 733, 630, C frmABOUT = 0, 0, 0, 0, C, 132, 174, 733, 630, C
Form2 = 110, 145, 711, 601, , 44, 58, 645, 514, C

View File

@ -5,7 +5,7 @@ VGMSTREAM * init_vgmstream_ps2_bmdx(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL; VGMSTREAM * vgmstream = NULL;
char filename[260]; char filename[260];
int loop_flag=0; int loop_flag=0;
int channel_count; int channel_count;
off_t start_offset; off_t start_offset;
int i; int i;
@ -18,37 +18,42 @@ VGMSTREAM * init_vgmstream_ps2_bmdx(STREAMFILE *streamFile) {
read_32bitBE(0x04,streamFile) != 0) read_32bitBE(0x04,streamFile) != 0)
goto fail; goto fail;
/* check loop */ /* check loop */
loop_flag = (read_32bitLE(0x10,streamFile)!=0); loop_flag = (read_32bitLE(0x10,streamFile)!=0);
channel_count=read_32bitLE(0x1C,streamFile); channel_count=read_32bitLE(0x1C,streamFile);
/* build the VGMSTREAM */ /* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag); vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail; if (!vgmstream) goto fail;
/* fill in the vital statistics */ /* fill in the vital statistics */
vgmstream->channels = channel_count; vgmstream->channels = channel_count;
vgmstream->sample_rate = read_32bitLE(0x18,streamFile); vgmstream->sample_rate = read_32bitLE(0x18,streamFile);
/* Check for Compression Scheme */ /* Check for Compression Scheme */
if (read_32bitLE(0x20,streamFile) == 1) if (read_32bitLE(0x20,streamFile) == 1)
vgmstream->coding_type = coding_invert_PSX; vgmstream->coding_type = coding_invert_PSX;
else else
vgmstream->coding_type = coding_PSX; vgmstream->coding_type = coding_PSX;
vgmstream->num_samples = read_32bitLE(0x0c,streamFile)*28/16/channel_count; vgmstream->num_samples = read_32bitLE(0x0c,streamFile)*28/16/channel_count;
/* Get loop point values */ /* Get loop point values */
if(vgmstream->loop_flag) { if(vgmstream->loop_flag) {
vgmstream->loop_start_sample = read_32bitLE(0x10,streamFile)*28/16/channel_count; vgmstream->loop_start_sample = read_32bitLE(0x10,streamFile)*28/16/channel_count;
vgmstream->loop_end_sample = vgmstream->num_samples; vgmstream->loop_end_sample = vgmstream->num_samples;
} }
if (channel_count == 1) {
vgmstream->layout_type = layout_none;
} else if (channel_count > 1) {
vgmstream->interleave_block_size = read_32bitLE(0x24,streamFile);
vgmstream->layout_type = layout_interleave;
}
vgmstream->interleave_block_size = read_32bitLE(0x24,streamFile);
vgmstream->layout_type = layout_interleave;
vgmstream->meta_type = meta_PS2_BMDX; vgmstream->meta_type = meta_PS2_BMDX;
start_offset = read_32bitLE(0x08,streamFile); start_offset = read_32bitLE(0x08,streamFile);
if (vgmstream->coding_type == coding_invert_PSX) if (vgmstream->coding_type == coding_invert_PSX)
{ {