if (chunkmode == "first")
{
bw.BaseStream.Position = 0x00001391;
}
if (chunkmode == "others")
{
bw.BaseStream.Position = 0x00001398;
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Imaging;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.IO;
using System.Media;
using WMPLib;
namespace NBA_Music_Tool___BETA
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
ofd.FileName = "nodata";
}
OpenFileDialog ofd = new OpenFileDialog();
private void pictureBox10_Click(object sender, EventArgs e)
{
Application.Exit();
}
byte[] muzikazapisanje = { };
string filename = "";
private void button1_Click(object sender, EventArgs e)
{
ofd.Title = "Select jukeboxmusic.bin to patch";
ofd.Filter = "jukeboxmusic.bin(*.bin)|*.bin";
ofd.ShowDialog();
if (ofd.SafeFileName=="jukeboxmusic.bin")
{
filename = ofd.FileName;
this.button2.Enabled = true;
this.button4.Enabled = true;
this.button6.Enabled = true;
}
}
string readmus = Directory.GetCurrentDirectory() + "\\temp.dat";
string readmus2 = Directory.GetCurrentDirectory() + "\\temp2.dat";
string readmus3 = Directory.GetCurrentDirectory() + "\\temp3.dat";
private void button2_Click(object sender, EventArgs e)
{
muzikazapisanje = ReadAllBytes(readmus);
button3.Enabled = true;
}
private void button3_Click(object sender, EventArgs e)
{
BinaryWriter bw = new BinaryWriter(File.Open(ofd.FileName, FileMode.Open, FileAccess.ReadWrite));
bw.BaseStream.Position = 0x00000060;
//byte[] obr = muzikazapisanje.Reverse().ToArray();
//Array.Reverse(muzikazapisanje, 0, muzikazapisanje.Length);
bw.Write(muzikazapisanje);
bw.Flush();
bw.Close();
button3.Enabled = false;
}
public static UInt32 ReverseBytes(UInt32 value)
{
return (value & 0x000000FFU) << 24 | (value & 0x0000FF00U) << 8 |
(value & 0x00FF0000U) >> 8 | (value & 0xFF000000U) >> 24;
}
public byte[] ReadAllBytes(string fileName)
{
byte[] buffer = null;
using (FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read))
{
buffer = new byte[fs.Length];
fs.Read(buffer, 0, (int)fs.Length);
}
return buffer;
}
private void button5_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void button4_Click(object sender, EventArgs e)
{
muzikazapisanje = ReadAllBytes(readmus2);
button3.Enabled = true;
}
private void button6_Click(object sender, EventArgs e)
{
muzikazapisanje = ReadAllBytes(readmus3);
button3.Enabled = true;
}
string chunkmode = "";
/// Read Chunk From jukeboxmusic.bin
private void button7_Click(object sender, EventArgs e)
{
BinaryReader br = new BinaryReader(File.Open(ofd.FileName, FileMode.Open, FileAccess.Read));
if (checkBox1.Checked == true)
{
br.BaseStream.Position = 0x00000063;
chunkmode = "first";
chunky = br.ReadBytes(0x39FF);
}
if (checkBox2.Checked == true)
{
br.BaseStream.Position = 0x00007527;
chunkmode = "others";
chunky = br.ReadBytes(0x39FF);
}
if (checkBox3.Checked == true)
{
br.BaseStream.Position = 0x001E729B;
chunkmode = "others";
chunky = br.ReadBytes(0x39FF);
}
br.Close();
}
byte[] chunky = { }; /// array of chunk bites (0x3FF)
///Play Process
private void PlayFile(String url)
{
WMPLib.WindowsMediaPlayer wmp = new WindowsMediaPlayer();
wmp.URL = url;
wmp.controls.play();
}
///Stop Process
private void StopFile(String url)
{
WMPLib.WindowsMediaPlayer wmp = new WindowsMediaPlayer();
wmp.URL = url;
wmp.controls.stop();
}
///[b]WMV Stop[/b]
private void button8_Click(object sender, EventArgs e)
{
StopFile(Directory.GetCurrentDirectory() + "\\temp.wmv");
}
/// [b]WMV Player[/b]
private void button9_Click(object sender, EventArgs e)
{
PlayFile(Directory.GetCurrentDirectory() + "\\temp.wmv");
}
private void button10_Click(object sender, EventArgs e)
{
BinaryWriter bw = new BinaryWriter(File.Open(Directory.GetCurrentDirectory() + "\\temp.wmv", FileMode.Open, FileAccess.ReadWrite));
if (chunkmode == "first")
{
bw.BaseStream.Position = 0x00001391;
}
if (chunkmode == "others")
{
bw.BaseStream.Position = 0x00001398;
}
bw.Write(chunky);
bw.Flush();
bw.Close();
}
}
}
Leftos wrote:I'm guessing you haven't found a way to play more than 2 chunks at a time by adding them both to a wma file, eh? Good job nevertheless, I'll add the functionality to the Audio Editor if you allow me to.
Leftos wrote:It's not one of those issues. The file is written correctly, but other than a fraction of a second of sound, the file stops playing. Can you upload an edited temp.wmv of yours that your tool has produced and plays a whole chunk from, as in at least a second?
Ruckzell17 wrote:Yes! And pls make it compatible to xp...
Leftos wrote:I've figured out a way to play all the audio files inside the .bin files with an xWMA header (the one produced by xWMAencode.exe, which the Audio Editor already uses), rather than WMV/WMA. I'll upload the new version soon.
Leftos wrote:Here you go:
jukeboxmusic.bin with Mercy replaced: http://www.mediafire.com/download/de881 ... oxmusic.7z
Song that replaced Mercy: http://www.mediafire.com/listen/o6ngc3d ... vision.mp3
(It's a creative commons licensed song, so no worries. )
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Linq;
namespace NBA2K_JumpingFIX
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.button6.Enabled = false;
this.button9.Enabled = false;
ofd.FileName = "nodata";
}
OpenFileDialog ofd = new OpenFileDialog();
byte[] jukeboxfile = { };
byte[] sectionheaders = { 0x69, 0xA1, 0xBE, 0xD2, 0x02, 0x00, 0x00, 0x00, 0xCD, 0x05, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x44, 0xAC };
// SELECT FILE
private void button1_Click(object sender, EventArgs e)
{
ofd.Title = "Select juke to patch";
if (ofd.ShowDialog() == DialogResult.OK)
{
jukeboxfile = File.ReadAllBytes(ofd.FileName);
this.button6.Enabled = true;
}
}
// Close TOOL
private void button3_Click(object sender, EventArgs e)
{
Application.Exit();
}
// ListOfSectionHeaders offsets = INTS
private List<string> SectionHeaders = new List<string>();
// Find sections offsets
private void button6_Click(object sender, EventArgs e)
{
int n = IndexOfBytes(jukeboxfile, sectionheaders, 0, jukeboxfile.Length);
int b = IndexOfBytes(jukeboxfile, sectionheaders, 4, jukeboxfile.Length);
int jukeboxsize = jukeboxfile.Length;
int foundlocation = new int();
int location = new int();
for (location = 0; location < 859424; location++)
{
foundlocation = IndexOfBytes(jukeboxfile, sectionheaders, location, jukeboxsize);
if (foundlocation != -1)
{
SectionHeaders.Add(foundlocation.ToString());
location = location + 18;
}
else
{
location = location + 1;
}
}
SectionHeaders = SectionHeaders.Distinct().ToList();
MessageBox.Show("Ready");
listBox1.DataSource = SectionHeaders;
this.button9.Enabled = true;
}
// Index of offsets function
public int IndexOfBytes(byte[] array, byte[] pattern, int startIndex, int count)
{
if (array == null || array.Length == 0 || pattern == null || pattern.Length == 0 || count == 0)
{
return -1;
}
int i = startIndex;
int endIndex = count > 0 ? Math.Min(startIndex + count, array.Length) : array.Length;
int fidx = 0;
int lastFidx = 0;
while (i < endIndex)
{
lastFidx = fidx;
fidx = (array[i] == pattern[fidx]) ? ++fidx : 0;
if (fidx == pattern.Length)
{
return i - fidx + 1;
}
if (lastFidx > 0 && fidx == 0)
{
i = i - lastFidx;
lastFidx = 0;
}
i++;
}
return -1;
}
// Place to store 2 bytes from 0x15
byte[] copypaste = { };
private void button9_Click(object sender, EventArgs e)
{
foreach (string sas in listBox1.Items)
{
if (sas != string.Empty)
{
// Read 2 bytes from 0x15 of section
BinaryReader br = new BinaryReader(File.Open(ofd.FileName, FileMode.Open, FileAccess.Read));
long ii1 = Convert.ToInt64(sas) + 0x15;
br.BaseStream.Position = ii1;
copypaste = br.ReadBytes(2);
br.Close();
//Write 2 bytes to 0x5D from sections
BinaryWriter bw = new BinaryWriter(File.Open(ofd.FileName, FileMode.Open, FileAccess.Write));
long aii1 = Convert.ToInt64(sas) + 0x5D;
bw.BaseStream.Position = aii1;
bw.Write(copypaste);
bw.Flush();
bw.Close();
Array.Clear(copypaste, 0, copypaste.Length);
}
else
{
}
}
MessageBox.Show("Done");
}
}
}
Leftos wrote:By sections you mean the chunks that we know? That's what I get from your sectionheaders array which starts with 0x69A1BED2.
byte[] sectionheaders = { 0x69, 0xA1, 0xBE, 0xD2, 0x02, 0x00, 0x00, 0x00, 0xCD, 0x05, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x44, 0xAC };
nesa24 wrote:i dont get it mate
i have tried on your and R4zor jukebox and didnt have skipping after fix
realy dont get it how it isnt working with you
R4zoR wrote:nesa24 wrote:i dont get it mate
i have tried on your and R4zor jukebox and didnt have skipping after fix
realy dont get it how it isnt working with you
Ahh can u send me through PM the fixed version of my released soundtrack, want to test it out.
nesa24 wrote:R4zoR wrote:nesa24 wrote:i dont get it mate
i have tried on your and R4zor jukebox and didnt have skipping after fix
realy dont get it how it isnt working with you
Ahh can u send me through PM the fixed version of my released soundtrack, want to test it out.
ok. later. cant now.
Users browsing this forum: No registered users and 39 guests