• Please stop embedding files/images from Discord. Discord has anti-hotlinking logic in place that breaks links to Discord hosted files and images when linked to from anywhere outside of Discord. There are a multitude of file/image hosting sites you can use instead.

    (more info here)

Cave Story Tribute Site Forums

20kdc
20kdc
Noxid
Noxid
This is... actually really cool. And a hell of a lot easier than my approach of hard-coding the entries into the .rdata segment, lol

You may also be interested in <a href='https://dl.dropboxusercontent.com/u/42853625/Assembly' class='bbc_url' title='External link' rel='nofollow external'>https://dl.dropboxus...853625/Assembly</a> Compendium.txt for some of your header values, I have pointers to the DDRAW object and DD7 Surfaces which could allow even more crazy stuff
Now if only windows programming wasn't such a massive pain in the ass...
Noxid
Noxid
20kdc
20kdc
Wow. That is detailed.
I kind of consider the Universal NPC system messy, as it adds a extra file,
but certainly better for people who don't like ASM.
What do you mean by "hard-coding the entries into the .rdata segment", though?

If there were C signatures, I could just go ahead and put them into cavestory.h, and everything would work basically by magic. I should be able to work that out, but I'm not really bothered-I'm sure you all know how to call the methods anyway, you just need to add in the signatures yourselves.
It should be quite possible to force a redirect so that ALL NPCs by default call the NPC216 pointer(chosen since it's basically unused), which then calls the correct per-NPC function as Cave Story would if the mod developer doesn't need to override that NPC.

Finally, it may be possible to embed game.dll into the Cave Story executable itself, but it would require adding extra sections into the EXE(which WILL trigger a ton of antiviruses), and would require a modified version of universalnpc.txt which has to be applied *after* the position the DLL will be linked at has been decided(but before it's actually linked) so that the pointers are correct(GetProcAddress wouldn't work under this scenario, you see)

How did you collect all this information, it's really detailed!
20kdc
20kdc
(Note that "If there were C signatures" refers to your function list. I kind of placed the sentence above as a afterthought...)
(Yet another note: Also, how is it nobody has thought of this before???)
Noxid
Noxid
I did something similar once, to link pxtone.dll to cave story as a proof of concept. But, how I approached it was, to go into the imports segment of the exe and add entries there for libraries that are loaded on startup. The import table needed to be relocated though and there were a lot of complications. I didn't realize you could just do this.

there are a lot of things you could do with it, and I think it would be an exercise best left to the implementer. But having a good cavestory.h file would make things a lot easier for anyone that wanted to use it.

As for putting the dll inside the game itself, I don't really consider that to be really necessary. I mean, I guess you could expand the .text segment, it probably wouldn't be much of a stretch for BL to be able to do that. But, I think one dll file is fine. You could even put it in the data folder, nobody would notice much.

anyway, that info has just been put together by a handful of modders over many years who kept poking at this game until all its guts had been pulled out and then some.
20kdc
20kdc
You don't even need to expand the .text segment-You can just create another one. Same goes with data segments. But there's no real point unless people start to consider game.dll a sure sign that "the mod-author is a cop-out who can't handle ASM" or somesuch. If that happens everything will go wrong...

Anyway, feel free to make a "redirect everything to NPC216" ASM mod, then expand cavestory.h with a #define BASECALL(npc) so you can call back to the old NPCs. Which would basically make the NPC overwrite part of this complete.

I'd like to see a complete version of this, but you're probably more experienced with the DirectX APIs(I literally have never programmed with DirectX, in C or ASM, in my life.), and Cave Story ASM modding itself for that matter-thus you'd be a better person to expand upon this.
20kdc
20kdc
....*sigh* Ignore all the extra comment notifications I've generated, I keep having to revise my ASM mod for all NPCs redirected to 216's routine...
Noxid
Noxid
expanding the text segment would be a technique to avoid false-flag by virus scanners as opposed to creating a second one. But yeah, it doesn't really matter. I assume people would be MORE impressed by DLL hooking, since it requires some more in-depth knowledge than just vanilla asm.

and tbh I never touched DirectX, it's a mess to work with. When I did windows graphic programming I used the Allegro library. Externalizing the NPC behaviours could be done pretty easily, but it would take a while to duplicate all their AI in C <img src='http://www.cavestory.org/forums/public/style_emoticons/default/tongue2.gif' class='bbc_emoticon' alt=':p' />
Noxid
Noxid
You should make a thread for this, I think it is useful to the community
plus it'll be easier to read
20kdc
20kdc
Almost done making a "template mod".
20kdc
20kdc
It doesn't externalize the NPC behaviors, it simply calls back inside the Cave Story EXE.
Back
Top