Kuribo64
Views: 23,103,643 Home | Forums | Uploader | Wiki | Object databases | IRC
Rules/FAQ | Memberlist | Calendar | Stats | Online users | Last posts | Search
12-05-24 07:45 AM
Guest:

0 users reading BCSV Editor | 1 bot

Main - Archived forums - SMG hacking tools development - BCSV Editor Hide post layouts | New reply

Pages: 1 2
Marionumber1
Posted on 11-25-12 10:47 PM (rev. 3 of 07-27-13 04:01 PM) Link | #1240
This is a tool that I made that edits BCSV files. If you don't know what BCSV files are, they are a file format that is used frequently in the Super Mario Galaxy games. BCSV files hold level data, object information, world map layouts, collision data, the songs that are played for each level, a list of objects that can be used in levels, and more.

BCSV Editor: https://www.dropbox.com/s/thc3rep4kvj1q32/BCSVE-v0.7.zip?dl=1

Source Code: https://dl.dropbox.com/s/bvhbohxx3bxvu5u/BCSVECode.zip?dl=1

The current version has the ability to edit any type of BCSV field data (longs, floats, shorts, bytes, and strings). Most BCSV files in SMG1 and SMG2 should work. Tell me if you find any BCSV files that the editor won't open or edit correctly.

In order to tell if a file is a valid BCSV file, check its extension. Files with the extension .bcsv, .tbl, .banmt, .bcam, and .pa should work. If a file has no extension, try opening it in the BCSV editor and editing it. If you can successfully open the file, edit it, then reopen it, you can assume that file is a valid BCSV file. If you find any files with extensions I haven't listed that seem to be valid BCSV files, send me a copy of that file.

You need Windows to run this, although it may run on Mac or Linux with Wine. lookup.txt needs to be in the same directory as the application.

Arisotura
Posted on 11-25-12 10:53 PM Link | #1241
Since it's C#, I guess it'll run fine on Linux and OSX.

It seems to be a nice tool for editing field properties, however it wouldn't be quite practical to use for editing lots of fields directly.

Also, it seems to mess up Japanese strings. Strings in BCSV files are encoded in Shift-JIS, so you know :)

____________________
NSMBHD - Kafuka - Jul
melonDS the most fruity DS emulator there is

zafkflzdasd

Marionumber1
Posted on 11-25-12 10:56 PM Link | #1242
It doesn't actually edit field properties yet. That's a planned feature, as soon as everything else in the editor is working. Also, I know they're encoded in Shift-JIS, but I've never been able to get it working.

Arisotura
Posted on 11-25-12 10:59 PM Link | #1243
If you want, I have some code from Whitehole C# that handled Shift-JIS strings...

____________________
NSMBHD - Kafuka - Jul
melonDS the most fruity DS emulator there is

zafkflzdasd

Marionumber1
Posted on 11-26-12 11:37 PM Link | #1246
Looking at your code, it looks like you used the FileBase class and set Encoding to "shift-jis". Is there anyway to convert an ASCII encoded string to a Shift JIS string, without making major changes to my code?

Shane2100AD
Posted on 11-27-12 02:51 AM Link | #1247
Do you mind if I upload the source onto GitHub?

Arisotura
Posted on 11-27-12 10:24 AM Link | #1252
Posted by Marionumber1
Looking at your code, it looks like you used the FileBase class and set Encoding to "shift-jis". Is there anyway to convert an ASCII encoded string to a Shift JIS string, without making major changes to my code?

What you have to do in C# is specify the encoding you want to use when you create your BinaryReader/Writer or similar.

Java works differently in that regard. For example I'm able to specify the encoding when reading/writing the strings.

____________________
NSMBHD - Kafuka - Jul
melonDS the most fruity DS emulator there is

zafkflzdasd

Dirbaio
Posted on 11-27-12 04:14 PM Link | #1254
Posted by Shane2100AD
Do you mind if I upload the source onto GitHub?

It's probably a bad idea. GitHub is not a place just to "upload" source code, it's a place to host git repositories. It's the project owner that should own the repository...

____________________
Cool Stuff: Dirbaio.net (my boring site) - The NSMB Hacking Domain - Kuribo64 - ABXD DevBoard

Marionumber1
Posted on 11-27-12 10:00 PM Link | #1260
Posted by Mega-Mario
What you have to do in C# is specify the encoding you want to use when you create your BinaryReader/Writer or similar.

Java works differently in that regard. For example I'm able to specify the encoding when reading/writing the strings.


What I do to read a string is read each character from FileStream, and concatenate it to the current string. When I concatenated the character to the string, I used string.Concat. I changed the encoding to System.Text.Encoding.GetEncoding("shift-jis"), but instead of displaying Japanese, it displays ・モ・ス・イ・・・フ・i・] (which is ff fe fb 30 93 ff fb 30 7d ff fb 30 72 ff fb 30 fb 30 fb 30 8c ff fb 30 69 00 fb 30 5d 00 in hex).

Arisotura
Posted on 11-27-12 10:49 PM Link | #1261
That's because this is just not how you read a NULL-terminated string from a file.

You create a BinaryReader with the Shift-JIS encoding, and then use the ReadString() method, which handles everything for you.

Alternately, if you don't want to use a BinaryReader, you need to create an array of bytes, and read each byte until you meet a NULL byte. You then feed the byte array to the appropriate text encoding converter to get a String.

____________________
NSMBHD - Kafuka - Jul
melonDS the most fruity DS emulator there is

zafkflzdasd

Phantom Wings
Posted on 12-19-12 08:09 AM (rev. 4 of 12-11-13 08:49 AM) Link | #1931
I know this thread is kind of old, but the AnarchGalaxy2 library had a pretty effective BCSV editor. I'm can't remember if I publicly released it or not, but I think it should come in handy.

Source Download

Also, just in case you're interested, MN1, The method I used to read Unicode strings was Encoding.GetEncoding("Shift-JIS").GetString which allowed you to read a string from either a byte buffer or a raw data pointer.

NWPlayer123
Posted on 12-19-12 07:26 PM Link | #1939
AFAIK Anarchy2 was never found if it was released. I never had it, at least.

____________________
"I hate playing musical chats" ~ Quote of the month

Marionumber1
Posted on 12-19-12 10:36 PM Link | #1942
Thanks for the source code, PhantomWings. I'm going to try to update my BCSV Editor this weekend.

Marionumber1
Posted on 12-24-12 05:31 PM Link | #2091
I've tried reading every byte into a Byte array and using Encoding.GetEncoding("Shift-JIS").GetString to convert it to Shift JIS, but Japanese text is still only displayed in ASCII characters.

Arisotura
Posted on 12-24-12 06:24 PM Link | #2092
Did you try the BinaryReader method I mentioned?

If you want, the C# version of Whitehole used it, so I could give you some code.

____________________
NSMBHD - Kafuka - Jul
melonDS the most fruity DS emulator there is

zafkflzdasd

Marionumber1
Posted on 12-24-12 06:50 PM Link | #2096
I didn't use the BinaryReader method, because I don't like the idea of drastically changing my code.

Arisotura
Posted on 12-24-12 07:00 PM Link | #2097
You should still have a look into it. It has always worked fine for me.

I also wish Java supported an equivalent. It only supports reading Unicode strings. The code I made to get around this is incredibly hackish and also picky. Blarg blarg. And I'm sure it'll be terribly unefficient when dealing with the message files.

____________________
NSMBHD - Kafuka - Jul
melonDS the most fruity DS emulator there is

zafkflzdasd

Marionumber1
Posted on 12-24-12 07:01 PM Link | #2098
The good news is that the strings in the message files are Unicode. Back on this topic, do you know why the method I tried wouldn't work?

Phantom Wings
Posted on 12-25-12 08:08 PM Link | #2125
I forgot that I had added an extension method to the Encoding class to simplify things.

Anyways, the extension method uses the string constructor using the Encoding as one of the parameters. You need to know the number of characters before hand and you need to use an sbyte pointer, but it should properly convert the characters.

Marionumber1
Posted on 12-31-12 07:54 PM (rev. 2 of 12-31-12 07:54 PM) Link | #2539
fixed (SByte* strData = bytes.ToArray())
{
str = new String(strData, 0, bytes.ToArray().Length, System.Text.Encoding.GetEncoding("Shift-JIS"));
}

Now I get an error saying "Pointers and fixed size buffers may only be used in an unsafe context".
Pages: 1 2

Main - Archived forums - SMG hacking tools development - BCSV Editor Hide post layouts | New reply

Page rendered in 0.045 seconds. (2048KB of memory used)
MySQL - queries: 29, rows: 236/236, time: 0.009 seconds.
[powered by Acmlm] Acmlmboard 2.064 (2018-07-20)
© 2005-2008 Acmlm, Xkeeper, blackhole89 et al.