• 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)

The most painful command I've ever thought of in my life. (WAVE Swap)

Feb 14, 2025 at 7:43 PM
Junior Member
"It's dangerous to go alone!"
Join Date: May 18, 2024
Location: First Cave
Posts: 34
Pronouns: He/him
So to put it simply, I want to make this command. (<WSW or <WSH. I can decide whether it should be Wave Swap or Wave shift.) Anyway, I thought it seemed simple to do, and now I have two versions of the game... One that has no waves yet somehow makes music and one that just flat out crashes when you try to play it. Any idea as to how I could make this actually work? (If the name didn't give it away already, the command is supposed to swap between two WAVE100 files.)

Below this is the command I was trying to replace for the WAVE command(FAC2). (By the way I replaced DIALOG_MUTE with my Wave which is what it's trying to find in this first giant block of ASM)

Code:
00424EAF   > A1 D85A4A00    MOV EAX,DWORD PTR DS:[4A5AD8]
00424EB4   . 0305 E05A4A00  ADD EAX,DWORD PTR DS:[4A5AE0]
00424EBA   . 0FBE48 01      MOVSX ECX,BYTE PTR DS:[EAX+1]
00424EBE   . 83F9 46        CMP ECX,46
00424EC1   . 75 70          JNZ SHORT doesnt_w.00424F33
00424EC3   . 8B15 D85A4A00  MOV EDX,DWORD PTR DS:[4A5AD8]
00424EC9   . 0315 E05A4A00  ADD EDX,DWORD PTR DS:[4A5AE0]
00424ECF   . 0FBE42 02      MOVSX EAX,BYTE PTR DS:[EDX+2]
00424ED3   . 83F8 41        CMP EAX,41
00424ED6   . 75 5B          JNZ SHORT doesnt_w.00424F33
00424ED8   . 8B0D D85A4A00  MOV ECX,DWORD PTR DS:[4A5AD8]
00424EDE   . 030D E05A4A00  ADD ECX,DWORD PTR DS:[4A5AE0]
00424EE4   . 0FBE51 03      MOVSX EDX,BYTE PTR DS:[ECX+3]
00424EE8   . 83FA 43        CMP EDX,43
00424EEB   . 75 46          JNZ SHORT doesnt_w.00424F33
00424EED   . A1 E05A4A00    MOV EAX,DWORD PTR DS:[4A5AE0]
00424EF2   . 83C0 04        ADD EAX,4
00424EF5   . 50             PUSH EAX                                 ; /Arg1
00424EF6   . E8 05CAFFFF    CALL doesnt_w.00421900                   ; \doesnt_w.00421900
00424EFB   . 83C4 04        ADD ESP,4
00424EFE   . 8945 DC        MOV DWORD PTR SS:[EBP-24],EAX
00424F01   . 0FBE4D DC      MOVSX ECX,BYTE PTR SS:[EBP-24]
00424F05   . 390D 0C5B4A00  CMP DWORD PTR DS:[4A5B0C],ECX
00424F0B   . 74 14          JE SHORT doesnt_w.00424F21
00424F0D   . 0FBE55 DC      MOVSX EDX,BYTE PTR SS:[EBP-24]
00424F11   . 8915 0C5B4A00  MOV DWORD PTR DS:[4A5B0C],EDX
00424F17   . C705 105B4A00 >MOV DWORD PTR DS:[4A5B10],800
00424F21   > A1 E05A4A00    MOV EAX,DWORD PTR DS:[4A5AE0]
00424F26   . 83C0 08        ADD EAX,8
00424F29   . A3 E05A4A00    MOV DWORD PTR DS:[4A5AE0],EAX
00424F2E   . EB 03          JMP SHORT doesnt_w.00424F33
00424F30   . 83F8 02        CMP EAX,2
00424F33   > 83F8 02        CMP EAX,2
00424F36   . 0F84 EB010000  JE doesnt_w.00425127
00424F3C   . E8 53E3FEFF    CALL doesnt_w.00413294
00424F41   . 6A 00          PUSH 0                                   ; |hModule = NULL
00424F43   . FF15 B4C04800  CALL DWORD PTR DS:[<&KERNEL32.FindResour>; \FindResourceA
00424F49   . 3E:8945 F8     MOV DWORD PTR DS:[EBP-8],EAX
00424F4D   . 3E:837D F8 00  CMP DWORD PTR DS:[EBP-8],0
00424F52   .^0F85 5A64FFFF  JNZ doesnt_w.0041B3B2
00424F58   . 33C0           XOR EAX,EAX
00424F5A   . EB 00          JMP SHORT doesnt_w.00424F5C
00424F5C   > 3E:8B45 F8     MOV EAX,DWORD PTR DS:[EBP-8]
00424F60   . 50             PUSH EAX                                 ; /hResource
00424F61   . 6A 00          PUSH 0                                   ; |hModule = NULL
00424F63   . FF15 B8C04800  CALL DWORD PTR DS:[<&KERNEL32.LoadResour>; \LoadResource
00424F69   . 50             PUSH EAX                                 ; /hResource
00424F6A   . FF15 BCC04800  CALL DWORD PTR DS:[<&KERNEL32.LockResour>; \LockResource
00424F70   . 3E:8945 FC     MOV DWORD PTR DS:[EBP-4],EAX
00424F74   . 68 00640000    PUSH 6400
00424F79   . 8B4D FC        MOV ECX,DWORD PTR SS:[EBP-4]
00424F7C   . 51             PUSH ECX
00424F7D   . 68 00E74900    PUSH doesnt_w.0049E700
00424F82   . E8 39C40500    CALL doesnt_w.004813C0
00424F87   . 83C4 0C        ADD ESP,0C
00424F8A   . B8 01000000    MOV EAX,1
00424F8F   . B9 02000000    MOV ECX,2
00424F94   . 2BC8           SUB ECX,EAX
00424F96   . E9 8C010000    JMP doesnt_w.00425127 ; Jumps back to the Parser
And below this is where WAVE100 is stored.
Code:
0041B380   $ 55             PUSH EBP
0041B381   . 8BEC           MOV EBP,ESP
0041B383   . 83EC 08        SUB ESP,8
0041B386   . 83F9 FF        CMP ECX,-1
0041B389   . 74 53          JE SHORT doesnt_w.0041B3DE
0041B38B   . 0000           ADD BYTE PTR DS:[EAX],AL
0041B38D   . EB 02          JMP SHORT doesnt_w.0041B391
0041B38F   . 33C0           XOR EAX,EAX
0041B391   > EB 00          JMP SHORT doesnt_w.0041B393
0041B393   > 68 C4C64800    PUSH doesnt_w.0048C6C4                   ; /ResourceType = "WAVE"
0041B398   . 68 CCC64800    PUSH doesnt_w.0048C6CC                   ; |ResourceName = "WAVE100"
0041B39D   . 6A 00          PUSH 0                                   ; |hModule = NULL
0041B39F   . FF15 B4C04800  CALL DWORD PTR DS:[<&KERNEL32.FindResour>; \FindResourceA
0041B3A5   . 8945 F8        MOV DWORD PTR SS:[EBP-8],EAX
0041B3A8   . 837D F8 00     CMP DWORD PTR SS:[EBP-8],0
0041B3AC   . 75 04          JNZ SHORT doesnt_w.0041B3B2
0041B3AE   . 33C0           XOR EAX,EAX
0041B3B0   . EB 31          JMP SHORT doesnt_w.0041B3E3
0041B3B2   > 8B45 F8        MOV EAX,DWORD PTR SS:[EBP-8]
0041B3B5   . 50             PUSH EAX                                 ; /hResource
0041B3B6   . 6A 00          PUSH 0                                   ; |hModule = NULL
0041B3B8   . FF15 B8C04800  CALL DWORD PTR DS:[<&KERNEL32.LoadResour>; \LoadResource
0041B3BE   . 50             PUSH EAX                                 ; /hResource
0041B3BF   . FF15 BCC04800  CALL DWORD PTR DS:[<&KERNEL32.LockResour>; \LockResource
0041B3C5   . 8945 FC        MOV DWORD PTR SS:[EBP-4],EAX
0041B3C8   . 68 00640000    PUSH 6400
0041B3CD   . 8B4D FC        MOV ECX,DWORD PTR SS:[EBP-4]
0041B3D0   . 51             PUSH ECX
0041B3D1   . 68 00E74900    PUSH doesnt_w.0049E700
0041B3D6   . E8 E55F0600    CALL doesnt_w.004813C0
0041B3DB   . 83C4 0C        ADD ESP,0C
0041B3DE   > B8 01000000    MOV EAX,1
0041B3E3   > 8BE5           MOV ESP,EBP
0041B3E5   . 5D             POP EBP
0041B3E6   . C3             RETN

Also, please note I'm pretty bad at assembly since I only made one patch, and I'm pretty sure someone already figured that out a while ago (basically, it's just adding Debug and mute back with one command replacing one command). By the way I also don't even know if this is even possible.:mrgreen:
 
Last edited:
Feb 15, 2025 at 5:32 AM
Moo~
"Life begins and ends with Nu."
Join Date: Jun 27, 2013
Location:
Posts: 2885
Age: 30
Pronouns: She/Her
What is the plan with your mod's music that warrants a full on changing of the WAVE100 mid-game, especially when each ORG file does not use all 100 waves in the soundfont? Either way, there is already such a hack that kinda already does the job for you, without the need of using TSC commands like those (and even then, if you were planning to change a wave one of the channels in your custom org is playing, that's going to be impossible cuz you need to sync the TSC to the song that's playing and you're already running into a wall, having one TSC script play continuously when there's everything else that needs to be run too).

You may have to look around in the #resources channel in the CSMC, but the hack in question is called "InfiniOrg", it already cuts the limit on the amount of orgs you can play in your mod, as well as making them not load internally in the game, but there's also an option to assign them their own WAVE100, if that tickles your fancy. It does depend on whether or not you plan on using more than a hundred waves, and even then, it's a hundred waves, you can make a lot of songs sharing the same WAVE100 file, limitations can become your optimizations. And even then, if your plan was to swap between the vanilla sounds and a custom soundfont, you can just overwrite the ones you don't plan on using with the custom waves you want playing in your mod. Work smarter, not harder!
 
Feb 15, 2025 at 4:31 PM
Junior Member
"It's dangerous to go alone!"
Join Date: May 18, 2024
Location: First Cave
Posts: 34
Pronouns: He/him
If I knew how to work assembly, I would be smarter instead of smashing the game harder. Anyways thanks for the help!


...It crashed my game a lot. I don't know how to make it stop.:mad:
 
Last edited by a moderator:
Feb 16, 2025 at 5:30 AM
Moo~
"Life begins and ends with Nu."
Join Date: Jun 27, 2013
Location:
Posts: 2885
Age: 30
Pronouns: She/Her
...It crashed my game a lot. I don't know how to make it stop.:mad:
Just in case you were missing an instruction:
<CMUabcd will now change the current music to "data\Orgs\abcd.org". "abcd" can be any ascii character, and letters are case sensitive. It will also load the instruments within "data\Orgs\abcd.dat" as a wave100 file.
If the "*.dat" file is not found, the game will simply skip loading it.
However, if the "*.org" file is not found, the game may crash.
The default/empty org is "0000.org", and the default wave100 is "0000.dat".

Those instructions mean pretty much, that you'll need to have your data folder set up like this:
a0jdzi.png


And to have the org and wave100's inside the Orgs folder named like this:
0knvmx.png


The WAVE100 file needs to be identical to the Org that is in use, the filenames need to be four characters long, and you will need to make sure the file extensions for both files are correct: .org for the song and .dat for the WAVE100 file. For the WAVE100 file, if you were to extract it from your mod/from OrgMaker/OrgView, and the program you're using is Resource Hacker or 7-Zip, you can very easily just add the ".dat" at the end of the file name, and it will register as a .dat file. If there's an Org that you're using but you still want to use the WAVE100 that is inside the game's internal resources, you don't need to make an "abcd.dat" file.

If these further instructions are followed and the game still seems to break on you, you will need to ask for further help in the CSMC, as there are users that frequent there that are more experienced with the hack.
 
Back
Top