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
MrAdults
Moderator
Posts: 1007
Joined: Mon Mar 23, 2009 2:57 am
Has thanked: 44 times
Been thanked: 505 times

Re: Spotlight: Señor Casaroja's Noesis

Post by MrAdults »

AceWell wrote:i don't think it will ever happen because someone would have already done it by now.
This is the seed of motivation that spurs mankind's progress throughout history. The burning desire and unstoppable drive to look at something as impossible, then ask some other dude to do it.
Acewell
VIP member
VIP member
Posts: 1330
Joined: Wed Nov 05, 2008 12:16 pm
Has thanked: 2710 times
Been thanked: 884 times

Re: Spotlight: Señor Casaroja's Noesis

Post by Acewell »

i think there is a misunderstanding here :)
i never asked for anyone to rebuild Texture Finder in Noesis, i just requested help with two things
1. to assist Wobble with expert help in unswizzling x360 textures from SWBF3.
2. to help me debug my example script so it works the way i have it commented, in a universal way.

If anyone else here can help with either of these, please post away! :D

edit
nevermind i figured out both problems. :D
Last edited by Acewell on Mon Feb 08, 2016 9:47 am, edited 1 time in total.
MrAdults
Moderator
Posts: 1007
Joined: Mon Mar 23, 2009 2:57 am
Has thanked: 44 times
Been thanked: 505 times

Re: Spotlight: Señor Casaroja's Noesis

Post by MrAdults »

1. Regarding that, Noesis gives you the functions you need and lots of example uses. So use them! It's not like you're going to find a special snowflake case unless they did some Crunch-like implementation. Either it's DXT or it's raw, and either it's endian-swapped or it's not, and you just need to take care to obey platform padding/alignment (on a per-row/block-row, per-mip, and/or per-face basis) beyond that. Using an untiling implementation that isn't broken as shit is a good idea too, which Noesis gives you.
2. It's misleading to ask someone for "help debugging", as this implies you actually wrote something or just need a tiny thing fixed for you to pick it back up yourself, when you actually more or less just copy-pasted some code from somewhere else and thought it might do something like what you want. It's fine if you can't program, but there's a big difference between "help me write this" and "write this for me". When someone says the former while reality dictates the latter, it's really irritating, as it does not give the sucker an accurate representation of the work they're getting themselves into by "helping".

If anyone wants to be the monkey here, he's asking for someone to create a big set of options to expose decoding methods for raw image data using every possible format/tiling/twiddling/etc. mode he might want to try, and if you want you can expose that through some shitty script variables at the top instead of writing some GUI code. This is likely to be a 30-60 minute task if you have some idea of what you're doing already. I'm not the monkey, too many things on the laundry list that time would be better-spent on.
User avatar
Wobble
ultra-veteran
ultra-veteran
Posts: 584
Joined: Tue Jan 04, 2005 9:47 pm
Has thanked: 43 times
Been thanked: 112 times

Re: Spotlight: Señor Casaroja's Noesis

Post by Wobble »

[out]
Last edited by Wobble on Sun Mar 12, 2017 10:55 am, edited 1 time in total.
Mr.Mouse
Site Admin
Posts: 4073
Joined: Wed Jan 15, 2003 6:45 pm
Location: Dungeons of Doom
Has thanked: 450 times
Been thanked: 682 times
Contact:

Re: Spotlight: Señor Casaroja's Noesis

Post by Mr.Mouse »

Pippi.jpg
You do not have the required permissions to view the files attached to this post.
User avatar
Wobble
ultra-veteran
ultra-veteran
Posts: 584
Joined: Tue Jan 04, 2005 9:47 pm
Has thanked: 43 times
Been thanked: 112 times

Re: Spotlight: Señor Casaroja's Noesis

Post by Wobble »

monkey.jpg
You do not have the required permissions to view the files attached to this post.
User avatar
Mirrorman95
ultra-veteran
ultra-veteran
Posts: 355
Joined: Tue Jul 20, 2010 2:08 am
Has thanked: 16 times
Been thanked: 24 times

Re: Spotlight: Señor Casaroja's Noesis

Post by Mirrorman95 »

I recently rendered a 16-bit greyscale PNG with 3DS Max, but when I loaded the image into Noesis, the areas looked all jagged and distorted, like if you tried to film a monitor and the diagonals would overlap. I think it may not be programmed to properly handle those kinds of PNGs.
BBSFM and KH2FM+ saves are compatible with KH2.5. viewtopic.php?t=13424
Snaz
beginner
Posts: 31
Joined: Sun Oct 18, 2015 8:46 pm
Has thanked: 7 times
Been thanked: 22 times

Re: Spotlight: Señor Casaroja's Noesis

Post by Snaz »

Hi it's me again.

So I took your advice, in case I was "feeling adventerous" and am right now trying to implement a plugin that reads the dark souls hkx animations (in c++), since someone was so kind as to send me a copy of a havok sdk version.

My plugin makes noesis crash though whenever I try to call havok code, I submitted a couple of crash reports after a day of tinkering.

I've noticed havok refuses to compile without 8 bytes struct member alignment... could that be part of the problem?

Unrelated to havok:
Is it possible to just load a skeleton without mesh data? I'd like to be able to do that, meaning parse a skeleton file when an animation is opened for preview, show the skeleton + animation, and be able to export that (which would also allow batch processing), but noesis asks me whether I'd like to export the file.

note: I may try exporting the animation data as xml and parse that if it doesn't work directly, but perhaps you may have some ideas as to what I can try to get havok and noesis to play ball.
MrAdults
Moderator
Posts: 1007
Joined: Mon Mar 23, 2009 2:57 am
Has thanked: 44 times
Been thanked: 505 times

Re: Spotlight: Señor Casaroja's Noesis

Post by MrAdults »

Default struct alignment doesn't matter, since there are pragmas around any shared structures that need alignment to be consistent. So that's not your problem.

As I can see in your crash report, the crash is in your code, and not Noesis:

0x0fa011fa (<unknown>@0x00000000, offset 0x11fa) - D:\Downloads\noesisv4169\plugins\darkdouls_hkx.dll

It's just that the Noesis exception handler is picking it up. You could single-step through your code up to the crash, or you can look at the crash report Noesis gives you. (it tells you the path to the dump before you send it off to me) As you can see, the offset into your module code is 0x11fa. If you're generating an address map (see Linker->Debugging->Generate Map File in your project settings) you can figure out which function the crash is in by using this address, and further narrow down where in the function the crash is by relating the disassembly of the function, getting the difference between 0x11fa and the base address of the function.

It's probably easier for you to just step through the code in debug yourself to figure out where you're crashing.
Snaz
beginner
Posts: 31
Joined: Sun Oct 18, 2015 8:46 pm
Has thanked: 7 times
Been thanked: 22 times

Re: Spotlight: Señor Casaroja's Noesis

Post by Snaz »

Thanks for that explanation, I didn't understand really well what I could do with the crash report before!

There's only one line it could crash one, which is one calling havok code I have no access to (instantiates a hkLoader class)... (uncommenting works)

What I'm more interested in though:
Snaz wrote: Is it possible to just load a skeleton without mesh data? I'd like to be able to do that, meaning parse a skeleton file when an animation is loaded, show the skeleton + animation, and be able to export that (which would also allow batch processing), but noesis asks me whether I'd like to export the file?
Do I simply add one random triangle to the model or is there a way to do this without that?

Thanks for taking the time <3
chrrox
Moderator
Posts: 2602
Joined: Sun May 18, 2008 3:01 pm
Has thanked: 57 times
Been thanked: 1422 times

Re: Spotlight: Señor Casaroja's Noesis

Post by chrrox »

i use this
def sksvmodLoadModel(data, mdlList):
ctx = rapi.rpgCreateContext()
sksv = sksvFile(NoeBitStream(data))
sksv.loadAll(sksv.bs)
try:
mdl = rapi.rpgConstructModel()
except:
mdl = NoeModel()
mdl.setModelMaterials(NoeModelMaterials(sksv.texList, sksv.matList))
mdlList.append(mdl); mdl.setBones(sksv.boneList)
return 1
Snaz
beginner
Posts: 31
Joined: Sun Oct 18, 2015 8:46 pm
Has thanked: 7 times
Been thanked: 22 times

Re: Spotlight: Señor Casaroja's Noesis

Post by Snaz »

Thanks! I got it to work in the end, although it kept crashing at export, (opening went just fine). Went with a converting path so the plugin wouldn't have to call havok code.

This is the result if anyone cares;

hkx converter to (custom) xml (.damnhavok actually) supports up until version hkx 2012.2 files binary packfiles, also noesis plugin viewing/exporting converted xml files, github release (as well as code):

https://github.com/Danilodum/dark_souls_hkx/releases

credits to Highflex and Figment for deciphering havok (github repos hkxcmd and havok2fbx)

Question:

What should the runtime library be for noesis plugins? Right now it is /MD like in unrealengine2_psk_psa, hope that's okay
MrAdults
Moderator
Posts: 1007
Joined: Mon Mar 23, 2009 2:57 am
Has thanked: 44 times
Been thanked: 505 times

Re: Spotlight: Señor Casaroja's Noesis

Post by MrAdults »

There's no good reason for Havok calls inside Noesis to crash. It could be that Havok is trying to try-catch an actual access violation and Noesis gets upset about that, but that would be pretty wretched of Havok. I know there are also all kinds of problems with Havok throwing floating point exceptions, but I don't think that's happening for you based on the exception code. I could potentially give a hook to disable the Noesis exception handler (or rather, force the filter to pass), although that seems especially ugly when the exception it's catching is an access violation.

/MD will work fine, but does rely on the user having the appropriate runtime on their system for the plugin DLL to load. You can use /MT if you want to just statically link the runtime, which will bloat the size of your DLL quite a bit. I usually statically link when it comes to major components. There are various downsides to statically linking the runtime, but most of them are outweighed by being able to guarantee something won't be happenstancely screwed up by problems with the user's installed runtime.

I'll add looking into making Havok calls from a plugin DLL to the todo list, although I'm in the middle of a gigantic task and don't expect to get to a new release for another month or two.
Snaz
beginner
Posts: 31
Joined: Sun Oct 18, 2015 8:46 pm
Has thanked: 7 times
Been thanked: 22 times

Re: Spotlight: Señor Casaroja's Noesis

Post by Snaz »

To clarify: Loading a model actually works, that is in loadmodel, havok code is called, that reads a file, is used to extract its contents and convert into matrices. Also this has nothing to do with the previous crash I was getting.

It is puzzling to me however why the same dll (same code) can load a model just fine, but crash when trying to export it? ( I was able to export from preview, but not directly off a file)
MrAdults
Moderator
Posts: 1007
Joined: Mon Mar 23, 2009 2:57 am
Has thanked: 44 times
Been thanked: 505 times

Re: Spotlight: Señor Casaroja's Noesis

Post by MrAdults »

Exports happen on another thread, so if Havok is pissy about stuff happening on anything other than the thread that created a given world/context and you're doing initialization outside of your handler (or persisting any data across invocations of your handler), that could do it. Best to do all of your init/shutdown within the handler to make sure it all happens on the same thread. Or have a dedicated Havok thread that does all of the work, and just implement your own mechanism for communicating commands (or whatever synchronization method you prefer) to push/pull data with that thread.

It's also possible that Havok would object to doing anything outside of the main application thread, but I don't think it should have any notions of what the main thread is, again unless you're performing an API call on another thread at some point.
Post Reply