Important information: this site is currently scheduled to go offline indefinitely by end of the year.

Spotlight: Señor Casaroja's Noesis

General game file tools that are useful for more than one game
finale00
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 2382
Joined: Sat Apr 09, 2011 1:22 am
Has thanked: 170 times
Been thanked: 307 times

Re: Señor Casaroja's Noesis

Post by finale00 »

chrrox wrote:just make a new function that reads one value and return tuple[0]
I'm only concerned that I would be making a ton of extra calls in between to go through the custom read method which would slow things down for anyone that uses it. Especially since I tend to read a lot of individual values rather than stringing them all together. It would be no different from the read_long and read_float methods.

Regarding models that are broken up into many small pieces across multiple files (like in some MMORPG's): I would like to be able to load them all into one scene. Is this possible? The GUI allows me to select only one file at a time.
MrAdults
Moderator
Posts: 1007
Joined: Mon Mar 23, 2009 2:57 am
Has thanked: 44 times
Been thanked: 505 times

Re: Señor Casaroja's Noesis

Post by MrAdults »

Use bs.read("i"*n) to get multiple ints in a nice tuple, use bs.readInt and so on if you just want to do a quick type read for a single element and never deal with a tuple or list. This is the fastest (computationally) way to read data and it's quite readable in my opinion.

To have multiple models visible you can either read them all into the same model container, or use the preview option to draw all models at once. In chrrox's yukes script he handles reading all of the yobj files in a single folder and putting them into a single model as well. I don't think he's released that yet though.

Satoh: Check out chrrox's Noesis tutorials over in the tutorial section. He demonstrates pretty much everything you need to know to get up and running, including how to visualize point data.
finale00
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 2382
Joined: Sat Apr 09, 2011 1:22 am
Has thanked: 170 times
Been thanked: 307 times

Re: Señor Casaroja's Noesis

Post by finale00 »

I have managed to assign materials to faces correctly after doing some math and figuring out how to cut up the index buffer.
The textures are stored in the local directory, but for whatever reason I want to create a texList with all of the texture objects (I guess for exporting).

So I started by opening the file...

Code: Select all

f = open(texName, 'rb')
...
And it gives me an IOError telling me that the specified file does not exist.
Not sure what I'm missing.
chrrox
Moderator
Posts: 2602
Joined: Sun May 18, 2008 3:01 pm
Has thanked: 57 times
Been thanked: 1422 times

Re: Señor Casaroja's Noesis

Post by chrrox »

just look at bullet witch it opens external files.

final fantasy 13-2 xbox 360 bms script.
this is the best i can do without having a decrypted file table.

Code: Select all

get NAME BASENAME
log MEMORY_FILE 0 0
put NAME string MEMORY_FILE
get size asize MEMORY_FILE
math size - 4
goto size MEMORY_FILE
getdstring EXT2 4 MEMORY_FILE
if EXT2 == "360"
set EXT "x360"
else
set EXT ps3
endif

comtype unzip_dynamic
for
findloc START string \x78\xDA
goto START
findloc END string 

\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
set SIZE end
math SIZE - START
goto END
if SIZE > 0x40
clog MEMORY_FILE START SIZE SIZE
getdstring SEDB 8 MEMORY_FILE
if SEDB == "SEDBRES "
goto 0x30 MEMORY_FILE
get COUNT long MEMORY_FILE
math COUNT * 16
math COUNT + 0x40
goto COUNT MEMORY_FILE
getdstring TRB 7 MEMORY_FILE
if TRB == "SEDBtxb"
string START + .
string START + EXT
get SIZE asize MEMORY_FILE
set NAME START
string NAME + .trb
log NAME 0 SIZE MEMORY_FILE
set NAME START
string NAME + .imgb
clog NAME OFFSET ZSIZE2 SIZE2
endif
endif
if SEDB != "SEDBRES "
set OFFSET START
set ZSIZE2 SIZE
get SIZE2 asize MEMORY_FILE
endif
endif
next
you can also run offzip and hunt of the texture files in the game.
Satoh
mega-veteran
mega-veteran
Posts: 194
Joined: Sat May 09, 2009 3:07 pm
Has thanked: 13 times
Been thanked: 38 times

Re: Señor Casaroja's Noesis

Post by Satoh »

How would I go about dealing with a mandatory parameter for Noesis? I'm trying to make a generic file splitter that allows the user to input the 'split at this marker' parameter. For instance I'm writing it to cut ADPCM files apart, they all always end in 0x00 07 77 77 77 77 77 77 77 77 77 77 77 77 77 77...

I want the ability to tell noesis to read until it sees this, write everything to a file, clear the read buffer, and begin from the current offset until the next marker, etc. but I want the marker to be user specified... I know I could use a parameter of some type for the batch processing, but how would I handle it for single files?
MrAdults
Moderator
Posts: 1007
Joined: Mon Mar 23, 2009 2:57 am
Has thanked: 44 times
Been thanked: 505 times

Re: Señor Casaroja's Noesis

Post by MrAdults »

Since it's a Python script, the simplest thing would be to simply make it a variable defined at the top of the file and let people edit it. It's not like opening a file in notepad.exe takes any real effort.

Otherwise, you could check for a commandline parameter, and use it if it exists. If it doesn't exist, pop up a window to prompt them for a value. This would be trivial in a native DLL, but since you're in Python, you'd have to try to get one of the Python windowing systems to work with Noesis. (you're on your own there)
finale00
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 2382
Joined: Sat Apr 09, 2011 1:22 am
Has thanked: 170 times
Been thanked: 307 times

Re: Señor Casaroja's Noesis

Post by finale00 »

I have a format with vertex structure that looks like it's parsed like this

Code: Select all

read 3 floats vx vy vz
read short unk1
if unk1 > 0
   read short unk2
   if unk2 > 0
      for i = 1 to unk1
         read int boneIdx
         read floatboneWeight
   else
       read float ?
And the normals + UV are stored with the indices.

1: Do you think there is most likely a way to determine the size of each vertex? (couldn't find one, no unknown data that is seemingly relevant, other files do not seem relevant either)
2: If the size of each vertex is not fixed, can I still use the RPG interface to construct the model?
3: There are likely more or less UV's and normals than there are vertices since it's at each index. How would I handle this?
Satoh
mega-veteran
mega-veteran
Posts: 194
Joined: Sat May 09, 2009 3:07 pm
Has thanked: 13 times
Been thanked: 38 times

Re: Señor Casaroja's Noesis

Post by Satoh »

Ok, I never expected I'd have to turn sound files into RGBA32 images in order to get noesis to let me read them... maybe I just did something stupid though... I did start on it at 5AM after being up all night... but regardless, I made it work... Now to start converting them to WAVs... or not "now" so much as when I come out of my coma...
MrAdults
Moderator
Posts: 1007
Joined: Mon Mar 23, 2009 2:57 am
Has thanked: 44 times
Been thanked: 505 times

Re: Señor Casaroja's Noesis

Post by MrAdults »

finale00: From the sound of it, you would be best off using the immBegin/immEnd/imm* functions to feed the data in. That mode, as mentioned a little while ago, is intended for formats where things like materials and vertex components tend to vary on a per-triangle basis. I tend to end up using it a lot on old PSX/PS2 games where storing components on a per-triangle basis was somewhat common.

Satoh: Good that you got it working, although you might consider using the archive handler instead of the image handler when you're doing generic data processing. :)
Satoh
mega-veteran
mega-veteran
Posts: 194
Joined: Sat May 09, 2009 3:07 pm
Has thanked: 13 times
Been thanked: 38 times

Re: Señor Casaroja's Noesis

Post by Satoh »

I would have if I better understood how to handle the parameters it requires... for instance I was working with an unknown length attribute.. or something I couldn't pass to the function anyway... I don't remember now... I was very tired. When I modularize the script I may look into it.

EDIT:
Ok, forgive me, I looked over the documentation, but I couldn't find it...

How do I make noesis render vertices in point render mode? IE: How do I make noesis draw dots based on my loaded data? Does it happen automatically if I don't supply triangle data or something??
MrAdults
Moderator
Posts: 1007
Joined: Mon Mar 23, 2009 2:57 am
Has thanked: 44 times
Been thanked: 505 times

Re: Señor Casaroja's Noesis

Post by MrAdults »

Satoh
mega-veteran
mega-veteran
Posts: 194
Joined: Sat May 09, 2009 3:07 pm
Has thanked: 13 times
Been thanked: 38 times

Re: Señor Casaroja's Noesis

Post by Satoh »

FFF.... Sorry I remember reading that... even bookmarking it... why did I forget...

Oh well, thanks for the link.
finale00
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 2382
Joined: Sat Apr 09, 2011 1:22 am
Has thanked: 170 times
Been thanked: 307 times

Re: Señor Casaroja's Noesis

Post by finale00 »

Is there a cleaner way to build transformation matrices?

Like for example I want to multiply x-coord by -1 so I would say

Code: Select all

transform = NoeMat43((NoeVec3((-1.0, 0.0, 0.0)), NoeVec3((0.0, 1.0, 0.0)), NoeVec3((0.0, 0.0, 1.0)), NoeVec3((0.0, 0.0, 0.0))))
rapi.rpgSetTransform(transform)
Last edited by finale00 on Tue Dec 20, 2011 7:23 am, edited 1 time in total.
Satoh
mega-veteran
mega-veteran
Posts: 194
Joined: Sat May 09, 2009 3:07 pm
Has thanked: 13 times
Been thanked: 38 times

Re: Señor Casaroja's Noesis

Post by Satoh »

Noesis doesn't seem to like displaying Shift-JIS characters... I'm not sure if it's because I'm doing something wrong or if it's a noesis bug... but this

Code: Select all

file_comps.append(bs.readBytes(0x1E).decode("Shift_JISx0213").rstrip("\0"))
print(file_comps)
Causes Noesis to crash when there are japanese characters in the string... Oddly it doesn't seem to crash if I don't print it, but at the same time, then I have no idea whether it decoded properly...(It happens when using shift_jis, shift_jis_2004, and shift_jisx0213 alike)

It's not a total kill error or anything... But it does make me a little irksome... I suppose I don't need the Jp portion of the object names I'm grabbing though, since they're tagged with things like MAT_, MDL_, etc. so long as they are parsed.

Anyway, figured I'd mention it...
finale00
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 2382
Joined: Sat Apr 09, 2011 1:22 am
Has thanked: 170 times
Been thanked: 307 times

Re: Señor Casaroja's Noesis

Post by finale00 »

I would also like clarification on non-ascii names, as the next format I have on my list has all chinese texNames and meshNames and matNames so unless people would like to rename all their files (like people suggest for blender scripts), I'd probably want to be able to parse unicode names correctly.

Then again, figuring out the encoding used is probably a whole different story (although it would be a matter of looking at the common encodings and then just trying them out I guess).
Post Reply