Adding more ORGs

Dec 4, 2009 at 8:00 PM
In my body, in my head
Forum Moderator
"Life begins and ends with Nu."
Join Date: Aug 28, 2009
Location: The Purple Zone
Posts: 5998
wedge of cheese said:
Well I don't think it's that simple. There's probably some list in the CS engine where it says like "song 0000 = XXXX, song 0001 = WANPAKU" etc (except not in plain english like that obviously). You would also have to modify that list, but as far as I know no one on the forums has ever found it.

That's because they never looked!

Code:
0048C838  58 58 58 58 00 00 00 00 57 41 4E 50 41 4B 55 00  XXXX....WANPAKU.
0048C848  41 4E 5A 45 4E 00 00 00 47 41 4D 45 4F 56 45 52  ANZEN...GAMEOVER
0048C858  00 00 00 00 47 52 41 56 49 54 59 00 57 45 45 44  ....GRAVITY.WEED
0048C868  00 00 00 00 4D 44 4F 57 4E 32 00 00 46 49 52 45  ....MDOWN2..FIRE
0048C878  45 59 45 00 56 49 56 49 00 00 00 00 4D 55 52 41  EYE.VIVI....MURA
0048C888  00 00 00 00 46 41 4E 46 41 4C 45 31 00 00 00 00  ....FANFALE1....
0048C898  47 49 4E 53 55 4B 45 00 43 45 4D 45 54 45 52 59  GINSUKE.CEMETERY
0048C8A8  00 00 00 00 50 4C 41 4E 54 00 00 00 4B 4F 44 4F  ....PLANT...KODO
0048C8B8  55 00 00 00 46 41 4E 46 41 4C 45 33 00 00 00 00  U...FANFALE3....
0048C8C8  46 41 4E 46 41 4C 45 32 00 00 00 00 44 52 00 00  FANFALE2....DR..
0048C8D8  45 53 43 41 50 45 00 00 4A 45 4E 4B 41 00 00 00  ESCAPE..JENKA...
0048C8E8  4D 41 5A 45 00 00 00 00 41 43 43 45 53 53 00 00  MAZE....ACCESS..
0048C8F8  49 52 4F 4E 48 00 00 00 47 52 41 4E 44 00 00 00  IRONH...GRAND...
0048C908  43 75 72 6C 79 00 00 00 4F 53 49 44 45 00 00 00  Curly...OSIDE...
0048C918  52 45 51 55 49 45 4D 00 57 41 4E 50 41 4B 32 00  REQUIEM.WANPAK2.
0048C928  51 55 49 45 54 00 00 00 4C 41 53 54 43 41 56 45  QUIET...LASTCAVE
0048C938  00 00 00 00 42 41 4C 43 4F 4E 59 00 4C 41 53 54  ....BALCONY.LAST
0048C948  42 54 4C 00 4C 41 53 54 42 54 33 00 45 4E 44 49  BTL.LASTBT3.ENDI
0048C958  4E 47 00 00 5A 4F 4E 42 49 45 00 00 42 44 4F 57  NG..ZONBIE..BDOW
0048C968  4E 00 00 00 48 45 4C 4C 00 00 00 00 4A 45 4E 4B  N...HELL....JENK
0048C978  41 32 00 00 4D 41 52 49 4E 45 00 00 42 41 4C 4C  A2..MARINE..BALL
0048C988  4F 53 00 00 54 4F 52 4F 4B 4F 00 00 57 48 49 54  OS..TOROKO..WHIT
0048C998  45 00 00 00                                      E...
That's where the names of the resources are stored.
Code:
00420F14  |. 8B0495 E881490>MOV EAX,DWORD PTR DS:[EDX*4+4981E8]
00420F1B  |. 50             PUSH EAX                                 ; /Arg1
00420F1C  |. E8 CFB7FFFF    CALL CS_ORG_e.0041C6F0                   ; \CS_ORG_e.0041C6F0

This is the line that tells which song to pick. EDX is the number from the TSC for the song ID. 4981E8 - 49828(C?) is a list of addresses that points to the various names. 41C6F0 finds and loads the resource ORG of name EAX.

There's enough room past 4981E8 for a 42 and 43 (You'd have to find some empty space somewhere else to put the name of the resource). If you wanted, say, a hundred new songs, you'd have to find a larger empty space than there is room for at 4981E8, because at 498238 there's stuff, and I don't know what it does.

After all that, you use your resource hacker to add the ORG and give it the appropriate name. The machine will find it for you, if you did things the normal way then it will be song 42. (probably)

Um, does that make sense?

EDIT: On a side note, I don't know what effects actually ADDING the resources (ORGS) themselves will have, or if it's anything more than just inflating the .exe Also, if you wanted to play with this stuff, the U for <CMU is at 00424313, the second call is the one you're interested in.

EDIT2: some other interesting tidbits I discovered: [4A4B00] is your position in the current song (measured in beats I would imagine?) and [4A57F8] seems to be the position in the last song played (stored for <RMU, like how [004a57fc] is last song ID)
 
Dec 4, 2009 at 8:55 PM
graters gonna grate
"Heavy swords for sale. Suitable for most RPG Protagonists. Apply now!"
Join Date: Jul 2, 2008
Location: &
Posts: 1886
Age: 31
Oooh, nice find there Nox! Those offsets might prove useful for me, because...

In the Paradise Project, I was gonna do some major hax to the in game organya player and TSC commands so that you had much more control over the music with new TSC commands (for example, you could change the repeat points, tempo, volume, track voice, or track volume on the fly with a TSC command or you could synchronize cutscenes with music using things like <MUJxxxx:yyyy:xxxx (jump to event x if song is between points y and z) or <WMUxxxx (wait for the song to pass point x) or <SKMxxxx (skip to point x in the music))

In any case, good job!
 
Dec 4, 2009 at 9:34 PM
Senior Member
"Huzzah!"
Join Date: Nov 23, 2009
Location: Outside of the core, not willing to progress.
Posts: 205
maaan, wish I knew more about assembly..
 
Dec 4, 2009 at 9:39 PM
Been here way too long...
"Life begins and ends with Nu."
Join Date: Jan 4, 2008
Location: Lingerie, but also, like, fancy curtains
Posts: 3054
you could learn.
it's not that hard, ya know.
 
Dec 4, 2009 at 9:46 PM
Creating A Legacy...
Bobomb says: "I need a hug!"
Join Date: Sep 6, 2009
Location: The Balcony
Posts: 852
Age: 29
Hey lace you know ive got sonic;s story on thw way (New demos been released :rolleyes: ) i would like to learn assembely. Any top tips?
 
Dec 4, 2009 at 10:00 PM
In my body, in my head
Forum Moderator
"Life begins and ends with Nu."
Join Date: Aug 28, 2009
Location: The Purple Zone
Posts: 5998
JetHawk95 said:
Hey lace you know ive got sonic;s story on thw way (New demos been released :rolleyes: ) i would like to learn assembely. Any top tips?

ProTip: Get >>This<<.

Makes a handy reference, and comes with the un-advanced tutorial! Other than that, just go around reading all the old Haxxing threads by RuneLancer and folks, these forums are a veritable goldmine of information
 
Last edited by a moderator:
Nov 13, 2012 at 9:48 PM
Been here way too long...
"Life begins and ends with Nu."
Join Date: Jan 4, 2008
Location: Lingerie, but also, like, fancy curtains
Posts: 3054
comes with the un-advanced tutorial!
oh, you mean the one I wrote? :D

yeah, that has all of the basic commands, but the best thing you can do is to just open your exe up in olly and start screwing around with the code.
you could try the tsc parser as a start, it's pretty easy to understand.

here's some offsets for that:
Code:
General:
0x422510 - Parser Start
0x4225d5 - Galloping Triplets
0x425770 - End of Parser
0x421900 - ASCII to number

Command Ini:
0x4242dA - CMU
0x422666 - LI+
0x4227a3 - IT+
0x422821 - IT-
0x422893 - EQ+
0x422907 - EQ-
0x422c93 - UNI
0x42314F - KEY
0x424e28 - FAC
0x424eaf - FAC(2)
0x4251fc - ESC

Command Subs:
0x420ee0 - CMU
0x419c60 - LI+
0x419cb0 - ML+
0x4012d0 - IT+
0x401330 - IT-
0x416c70 - EQ+
*

*(fac, esc, key, and others don't have subroutines)

testing for bump
 
Apr 27, 2023 at 8:49 PM
Junior Member
"Fresh from the Bakery"
Join Date: Apr 27, 2023
Location:
Posts: 16
Age: 17
Sorry to necropost by 11 years, but has anyone shared the infinite org hex hack here? Or was that an asm hack?

I've been dying to get my hands on it because I need to add extra orgs to a remake of an old mod that I never released, but uh, I think I'd need much more room than 42 and 43, and I wouldn't be able to learn assembly to save a life, especially my own. There's already 3 orgs I want to add, which would total to 44, so yeah that's already becoming a problem.

If anyone could kindly link (or paste) the hack here, whichever type it was (I can't remember), that would be amazing.
 
Apr 27, 2023 at 8:58 PM
War criminal
"Life begins and ends with Nu."
Join Date: Jun 27, 2013
Location: Phoenix
Posts: 2758
Age: 29
Sorry to necropost by 11 years, but has anyone shared the infinite org hex hack here? Or was that an asm hack?

I've been dying to get my hands on it because I need to add extra orgs to a remake of an old mod that I never released, but uh, I think I'd need much more room than 42 and 43, and I wouldn't be able to learn assembly to save a life, especially my own. There's already 3 orgs I want to add, which would total to 44, so yeah that's already becoming a problem.

If anyone could kindly link (or paste) the hack here, whichever type it was (I can't remember), that would be amazing.
I think it's this thread you're looking for.
 
Apr 27, 2023 at 9:19 PM
Junior Member
"Fresh from the Bakery"
Join Date: Apr 27, 2023
Location:
Posts: 16
Age: 17
Thank you so much. I couldn't find it for some reason... definitely bookmarking!!!
 
Apr 28, 2023 at 3:42 AM
Junior Member
"Fresh from the Bakery"
Join Date: Apr 27, 2023
Location:
Posts: 16
Age: 17
Uh... I hate to be the bearer of bad news, but I did everything in my power to add my 2 orgs and miraculously (yet unsurprisingly) failed. Looks like I'm gonna have to resort to org replacing after all...
 
Apr 28, 2023 at 4:40 AM
War criminal
"Life begins and ends with Nu."
Join Date: Jun 27, 2013
Location: Phoenix
Posts: 2758
Age: 29
Uh... I hate to be the bearer of bad news, but I did everything in my power to add my 2 orgs and miraculously (yet unsurprisingly) failed. Looks like I'm gonna have to resort to org replacing after all...
Did you find any free space for the org filenames to be read from? To be completely fair in my tutorial, I was messing with a modified executable, if you went with the exact places to plug the data in, we may have a problem.

Edit: Also don't use the program that Leo made, the game will not read from the new ram location and that hasn't been fixed in years.
 
Last edited:
Apr 28, 2023 at 6:33 PM
Junior Member
"Fresh from the Bakery"
Join Date: Apr 27, 2023
Location:
Posts: 16
Age: 17
Yeah, I was worried that was going to be a problem. I used the exact addresses input in your tutorial. Ironically, of the two copies I tested on, the one I used orgadder on had made more progress than the one without. At least the one I used orgadder on plays silence instead of the track that last played.

I also made an xml file so Booster's Lab could apply the patches for me. I have no damn clue how to use ollydbg. The few times I actually got it to save something, that sure was a workout.

Anyway, yeah, in terms of patches, literally all I need is the infinite orgs hack and then the actual orgs themselves to work. I don't plan on using any other major patches. (Maybe that's why odbg kept whining that some of the addresses were outside of the file. Thank god for CTRL+G.)
 
Apr 28, 2023 at 8:41 PM
Giving it my all and shooting for the moon.
Modding Community Discord Admin
"What're YOU lookin' at?"
Join Date: Apr 23, 2013
Location: In a cave above the surface.
Posts: 1068
Age: 25
Backup your mod (especially the exe), and then you can try these patches SEPERATELY to see if either works:

SlightlyIntelligentMonkey's Mus Data:
https://github.com/CaveStoryModdingCommunity/FreewareHacks/tree/main/Hex Patches/SIM - Mus Data Folder (includes folder for vanilla orgs)

Txin's Infiniorg:
https://github.com/CaveStoryModdingCommunity/FreewareHacks/blob/main/XML (BL Hackinator or BPP)/hacks/TSC/modifications/infinite_ORG.xml
Pre-made folder of vanilla tracks for above: https://cdn.discordapp.com/attachments/312733438153326593/694793574310739988/Org.zip

Also, you don't need to write an XML file or use OllyDbg to apply hex patches. Booster's Lab has a tool in Actions > Hex Patcher that allows you to apply patches you paste in.
 
Last edited:
Apr 28, 2023 at 8:45 PM
Junior Member
"Fresh from the Bakery"
Join Date: Apr 27, 2023
Location:
Posts: 16
Age: 17
I was considering using the hex patcher, but I thought an xml would be more convenient because I could patch the game quicker that way. I'll see how things go with the new patch...
EDIT (CUZ I DON'T WANNA DOUBLE POST): OHHHHMYGOD IT WORKED. Thank you so much, I'm so hyped to put this to use!!!
 
Last edited:
Apr 28, 2023 at 8:56 PM
Giving it my all and shooting for the moon.
Modding Community Discord Admin
"What're YOU lookin' at?"
Join Date: Apr 23, 2013
Location: In a cave above the surface.
Posts: 1068
Age: 25
Sorry, I also just added Txin's Infiniorg (which is probably the most popular method to achieve this) afterwards as an edit to the post above, but you were fast and read the post before the edit was made.
 
Apr 28, 2023 at 8:59 PM
Junior Member
"Fresh from the Bakery"
Join Date: Apr 27, 2023
Location:
Posts: 16
Age: 17
Ah! Yeah, I guess you could say I'm fast... I tried the mus data one and it worked, as indicated in the edit (cuz I didn't wanna end up double posting). You're a hero! :heart:
 
Apr 29, 2023 at 4:13 AM
War criminal
"Life begins and ends with Nu."
Join Date: Jun 27, 2013
Location: Phoenix
Posts: 2758
Age: 29
May 2, 2023 at 8:33 PM
Junior Member
"Fresh from the Bakery"
Join Date: Apr 27, 2023
Location:
Posts: 16
Age: 17
Uh oh... seems that using <TRA crashes the game with the mus data patch...
I thought it was because I was trying to <CLO an <MS2, or because I was trying to <TRA after using <HMC without <SMC eventually, but I was wrong... I thought this was a side effect of the other hex fuckery I'd done, but I redid all my changes in a brand new copy of CaveStory with ONLY the mus data patch and the game's still crashing... it shows the "has encountered a problem and needs to close" dialogue and everything...

1683055607864.png(Yes, I'm modding the game on Windows XP, just because I can.)
If I paste the events from the map it's supposed to <TRA to underneath that event, it just... loops the same event from the start again!? The intro text says "From somewhere, a conversation...", with the next room's text it simply repeats that. What in the... what?
Here's the intro event in question:

Code:
#0110
<HMC<KEY<CMUXXXX.ORG<WAI0050
<MS2From somewhere, a conversation...<NOD
<SMC<TRA0004:0112:0015:0009

Room 0004 is supposed to be a map titled "Your House - Rooftop" with filename TrioHouseTop, event 0112 is where the dialogue is supposed to continue, and yeah, the other two thingies are coords. Has anyone ever... tested this patch on a full-blown mod before...? I'm so confused as to why the game is crashing. (Please don't tell me it's because I'm using BoostLab 0.5.1.1...)
 
May 3, 2023 at 7:22 AM
War criminal
"Life begins and ends with Nu."
Join Date: Jun 27, 2013
Location: Phoenix
Posts: 2758
Age: 29
What room is Event 0110 in? And more importantly, is the org file in the mus data folder under data? Like this for example (SIM why didn't you put the entire soundtrack in the mus folder? :balrog:)
p378575-0-image.png


It seems to work for me as far as vanilla orgs go. Unless you're using any other ASM hack in particular... Or worst case scenario, it's Windows XP to blame.

Edit: Works fine with custom orgs too, looking at the important addresses used in the asm hack and in <TRA, there really shouldn't be anything interfering with each other.
 
Last edited:
Top