Kuribo64
Views: 19,993,845 Home | Forums | Uploader | Wiki | Object databases | IRC
Rules/FAQ | Memberlist | Calendar | Stats | Online users | Last posts | Search
04-19-24 09:01 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
Arisotura
Posted on 12-31-12 08:10 PM Link | #2540
You need some keyword, unsafe or fixed or something else, can't remember.

That's what I don't like in PW's coding style btw, using unsafe pointers and all...

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

zafkflzdasd

Marionumber1
Posted on 12-31-12 08:22 PM Link | #2543
I'm using the fixed keyword.

Phantom Wings
Posted on 01-01-13 12:11 AM Link | #2558
While heap memory and pointers may seem scary at first, you shouldn't knock them. Remember that these files have been specifically compiled for an environment that can use nothing but unsafe memory elements (RVL SDK is in C++). Marshalling data types from memory removes the need for excessive seeking and byte manipulation required when using streams. This also removes the need for dedicated read/write methods for each individual data type. Additionally, it allows you to use wrapper classes which removes the need for individually setting every field when reading in the more complex classes.

Anyways, MN1, if you're going to use unsafe memory in C#, you need the unsafe keyword either in the function declaration or the containing class declaration. You'll also need to go into the project properties and check "allow unsafe code" under build options.

Marionumber1
Posted on 01-01-13 03:36 PM Link | #2615
List<SByte> bytes = new List<SByte>();
String str;

while (bcsvFile.ReadByte() != 0)
{
bcsvFile.Seek(stringOffset + strOffs + strCount, SeekOrigin.Begin);
bytes.Add((SByte)bcsvFile.ReadByte());
strCount++;
}

unsafe
{
fixed (SByte* strData = bytes.ToArray())
{
str = new String(strData, 0, bytes.ToArray().Length, System.Text.Encoding.GetEncoding("Shift-JIS"));
}
}

this.data[i] = str;
this.size[i] = (Byte)strCount;

When I use this code, it works, but Japanese text is still displayed using ASCII characters.

Phantom Wings
Posted on 01-01-13 08:05 PM Link | #2624
Well, I tested your code with a string from the ObjectNameTable.tbl and it checks out on my end, here's the test code:


OpenFileDialog ofd = new OpenFileDialog();
if (ofd.ShowDialog() != DialogResult.OK)
return;

FileStream bcsvFile = File.Open(ofd.FileName, FileMode.Open);
List bytes = new List();
String str;
int stringOffset = 0;
int strOffs = 0;
int strCount = 0;

while (bcsvFile.ReadByte() != 0)
{
bcsvFile.Seek(stringOffset + strOffs + strCount, SeekOrigin.Begin);
bytes.Add((SByte)bcsvFile.ReadByte());
strCount++;
}

unsafe
{
fixed (SByte* strData = bytes.ToArray())
{
str = new String(strData, 0, bytes.ToArray().Length, System.Text.Encoding.GetEncoding("Shift-JIS"));
}
}

MessageBox.Show(str);


The input was from this file and the output was 天文台図書館. I might suggest that your computer doesn't support the Shift-JIS encoding, but if you've been using Anarchy and it has been displaying properly, then that likely isn't the case.

Arisotura
Posted on 01-01-13 08:15 PM Link | #2625
Perhaps a .NET update would fix it. I don't know how string encodings work in .NET.

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

zafkflzdasd

Marionumber1
Posted on 01-01-13 08:53 PM Link | #2626
Which version of .NET are you using, PhantomWings? The BCSV Editor is using .NET 3.5.

Phantom Wings
Posted on 01-01-13 10:49 PM Link | #2635
I'm using v3.5 SP1. I also retested the code segment up there just to make sure I didn't copy it wrong. It sounds like it's something in your system settings.

Marionumber1
Posted on 02-28-13 10:04 PM Link | #16770
Well, I guess that since I haven't updated this in a while, I'll release a new version. This one uses Shift-JIS code that doesn't seem to work on my PC, but PhantomWings says it does, so I'd appreciate people testing it and seeing if Japanese characters work.

https://www.dropbox.com/s/thc3rep4kvj1q32/BCSVE-v0.7.zip

shibboleet
Posted on 02-28-13 10:15 PM (rev. 2 of 02-28-13 10:15 PM) Link | #16772
[image]
Works like a charm. Nice job, Marionumber1!
(The weird clipping in the image was just a cropping fail.)

____________________
a

shibboleet
Posted on 07-27-13 07:48 AM Link | #29091
hmm..I don't mean to bump but...
Was the download taken down on purpose? Because this is the version that ADDS stuff.
https://kuribo64.net/get.php?id=2nm5EUidU21YhjHY
Here's a new download if anybody wants it.

____________________
a

Marionumber1
Posted on 07-27-13 01:19 PM Link | #29101
What do you mean, ADDS? The version I posted has the ability to add entries.

shibboleet
Posted on 07-27-13 02:38 PM Link | #29104
Ah. I didn't see the post above.
But can you still replace the link on the first post?

____________________
a

Jesse
(post deleted) #35520

shibboleet
(post deleted) #35522
Pages: 1 2

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

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