• Hey everyone happy Christmas Eve we're aware of what's happened with the source code so to keep this simple absolutely don't post it on the site or use it to make mods with (it's not particularly preferable toward this end anyway) and tread lightly in general until we see how this settles, thanks to all and have a great holiday season -DT

Quick Modding/Hacking Answers Thread

Jan 28, 2014 at 4:32 AM
leader of the meme team feat. tom, snaf and polad
"Wacka-Wacka-Wacka-Wacka-Wacka-Wacka-Wacka-Wacka-BLEIUP"
Join Date: Jan 24, 2014
Location: Polar✪
Posts: 301
Pronouns: he/him
Oh hi. I have another question. Err, less of a question, more of a "WHY IS THIS MAP CAUSING A CRASH" question.

p201118-0-tdnxyjr.png


I made a new room by duplicating Arthur's House and modifying it.

For the purpose of testing, its script is simply

p201118-1-tss1yl7.png


(So it shouldn't preform anything other then a fade-in.

The room's number is #97

p201118-2-ymaa1dm.png


and the script for entering is

p201118-3-k85gbjh.png
.

...despite all of this, the game crashes upon entering the room. Everything looks fine, but it's not, and I don't understand. I duplicated Arthur's House, so it should work...right? Even if I removed most of the old script.

An almost unneccesary addition on my own part but the error is the dreaded...whatever you call it.

p201118-4-wjzjcgn.png


Anyone have any idea what's wrong? If you have any more questions about specifics, ask, and I'll tell, if it'll help me figure out the error.

Oh, and for reference, I'm using Booster's Lab.
 
Jan 28, 2014 at 12:08 PM
Been here way too long...
"What're YOU lookin' at?"
Join Date: Jan 21, 2007
Location:
Posts: 1111
That error I think means some graphic file is missing on the target map. There should be an error.log in the folder where your exe is, open it up in notepad and see what it says.
 
Jan 28, 2014 at 10:19 PM
The TideWalker
Modding Community Discord Founder
"That dog!"
Join Date: Apr 5, 2013
Location: In my mind and of my body.
Posts: 1642
Age: 27
buffer_zps5e725514.png



What in the name of Pixels holy creation did I do?


All I did was rig a TSC command to a random number generator, and push a local variable before calling a function.
 
Jan 28, 2014 at 10:50 PM
leader of the meme team feat. tom, snaf and polad
"Wacka-Wacka-Wacka-Wacka-Wacka-Wacka-Wacka-Wacka-BLEIUP"
Join Date: Jan 24, 2014
Location: Polar✪
Posts: 301
Pronouns: he/him
So my issue resolved itself when I quit Booster's Lab. Huh.
So my issue resolved itself when I quit Booster's Lab. Huh.
 
Jan 28, 2014 at 10:57 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
Pronouns: he/him
PolarStarGames said:
So my issue resolved itself when I quit Booster's Lab. Huh.
So my issue resolved itself when I quit Booster's Lab. Huh.
might've been a desync between the mapdata in the game and the mapdata in the editor, especially if you weren't doing a force-save (ctrl-shift-s).

@BLink
a buffer overrun is when the program tries to write outside of a pre-allocated memory buffer. Most commonly people encounter it when they make credit scripts that exceed the game's in-built credit script buffer size.
I'm not entirely sure what you did to cause this since most problems with frame misalignment end up in segfaults rather than buffer overruns but maybe you did something weird with the TSC text output
 
Jan 28, 2014 at 11:19 PM
leader of the meme team feat. tom, snaf and polad
"Wacka-Wacka-Wacka-Wacka-Wacka-Wacka-Wacka-Wacka-BLEIUP"
Join Date: Jan 24, 2014
Location: Polar✪
Posts: 301
Pronouns: he/him
Noxid said:
might've been a desync between the mapdata in the game and the mapdata in the editor, especially if you weren't doing a force-save (ctrl-shift-s).

@BLink
a buffer overrun is when the program tries to write outside of a pre-allocated memory buffer. Most commonly people encounter it when they make credit scripts that exceed the game's in-built credit script buffer size.
I'm not entirely sure what you did to cause this since most problems with frame misalignment end up in segfaults rather than buffer overruns but maybe you did something weird with the TSC text output
...you can force save? That explains alot. I didn't see the option to force save in the tabs at the top, but I did put 2 and 2 together when Booster's Lab said the executable had unsaved changes.

I just didn't know how to save them without quitting the application, and at the time of the post, I had no idea that saving that was even seperate at all. It's a learning experience I guess. Atleast I know the proper bindings now.
 
Jan 29, 2014 at 12:26 AM
Junior Member
"Fresh from the Bakery"
Join Date: Jan 19, 2014
Location:
Posts: 16
Bombchu, did you perhaps not fix esp afterwards?
Also protip: it's easier for us to help you if you post some code.
 
Jan 29, 2014 at 12:57 AM
The TideWalker
Modding Community Discord Founder
"That dog!"
Join Date: Apr 5, 2013
Location: In my mind and of my body.
Posts: 1642
Age: 27
might've been a desync between the mapdata in the game and the mapdata in the editor, especially if you weren't doing a force-save (ctrl-shift-s).
@BLink
a buffer overrun is when the program tries to write outside of a pre-allocated memory buffer. Most commonly people encounter it when they make credit scripts that exceed the game's in-built credit script buffer size.
I'm not entirely sure what you did to cause this since most problems with frame misalignment end up in segfaults rather than buffer overruns but maybe you did something weird with the TSC text output

Bombchu, did you perhaps not fix esp afterwards?
Also protip: it's easier for us to help you if you post some code.




code it is then..



but first, how the command works.



<RNJ0002:EvNT:EvNT



Randomly select to jump to event 1 or 2



<RNJ0004:EvNT:EvNT:EvNT:EvNT



Randomly select to jump to event 1 through 4
Code:
offset 46d64c

;46D5D0

;use this offset if you have the IBF patch applied! --> 46d64c
;If you store 0 Or 1 to the first argument, don't be surprised if you have a crash. :/

#define

not_RNJ = 424F33 ; change this to your next custom TSC command (if you have one)

arg_handler  = [EBP-24]
arg1_var     = [EBP-28]
arg2_var     = [EBP-2C]
arg3_var     = [EBP-30]
arg4_var     = [EBP-34]
arg5_var     = [EBP-38]
arg6_var     = [EBP-3C]
arg7_var     = [EBP-40]
arg8_var     = [EBP-44]
arg9_var     = [EBP-48]
arg10_var    = [EBP-4C]

#enddefine


MOV EAX,DWORD PTR DS:[4A5AD8]
ADD EAX,DWORD PTR DS:[4A5AE0]
CMP BYTE PTR DS:[ECX+1],52            ;R
JNE not_RNJ
CMP BYTE PTR DS:[ECX+2],4E            ;N
JNE not_RNJ
CMP BYTE PTR DS:[ECX+3],4A            ;J
JNE not_RNJ

MOV EAX,DWORD PTR DS:[4A5AE0]         ;get Script Position
ADD EAX,4                             ;Add 4 to Script Position
PUSH EAX                              ;PUSH Script position
CALL 00421900                         ;CALL Ascii to number Function
ADD ESP,4                             ;Fix the stack

MOV arg_handeler, EAX          ;EAX holds our first 4 digits set move it to the handler

MOV EAX,DWORD PTR DS:[4A5AE0]         ;get Script Position
ADD EAX,9                             ;Add 9 to Script Position
PUSH EAX                              ;PUSH Script position
CALL 00421900                         ;CALL Ascii to number Function
ADD ESP,4                             ;Fix the stack

MOV arg1_var, EAX                     ;store first event into variable

MOV EAX,DWORD PTR DS:[4A5AE0]         ;get Script Position
ADD EAX,E                             ;Add 14 to Script Position
PUSH EAX                              ;PUSH Script position
CALL 00421900                         ;CALL Ascii to number Function
ADD ESP,4                             ;Fix the stack

MOV arg2_var, EAX                     ;store second event into variable
CMP arg_handeler, 2                   ;are there only 2 events set up?
JE :2_Random_Function

MOV EAX,DWORD PTR DS:[4A5AE0]         ;get Script Position
ADD EAX,E                             ;Add 14 to Script Position
PUSH EAX                              ;PUSH Script position
CALL 00421900                         ;CALL Ascii to number Function
ADD ESP,4                             ;Fix the stack

MOV arg3_var, EAX                     ;store third event into variable
CMP arg_handeler, 3                   ;Are there three events set up?
JE :3_Random_Function



:2_Random_Function
PUSH 1
PUSH 10
CALL Random
ADD ESP 8
CMP EAX, 5
JGE :EVE_2
PUSH arg1_var
JMP :2_RND
:EVE_2
PUSH arg2_var
:2_RND
CALL 00421AF0     ;Call this function to Jump to a TSC Event while the script is running.
ADD ESP,4
JMP 004252A7      ;this part goes back to the beginning of the parser.

:3_Random_Function
PUSH 1
PUSH 9
CALL Random
ADD ESP 8
CMP EAX, 3
JG :3_part2
PUSH arg1_var
JMP :3_RND
:3_part2
CMP EAX, 6
JG :3_part3
PUSH arg2_var
JMP :3_RND
:3_part3
PUSH arg3_Var
:3_RND
CALL 00421AF0     ;Call this function to Jump to a TSC Event while the script is running.
ADD ESP,4
JMP 004252A7         ;this part goes back to the beginning of the parser.
Overall fairly straight forward.



<RNJ0002:XXXX:XXXX doesn't work and I get no response unless I use <RNJ0003:XXXX:XXXX:XXXX (crashes the game)



and the script




Code:
#100
<RNJ0003:0200:0300:0400<END
 
#0200
<CNP0600:0001:0000<END
 
#0300
<CNP0600:0015:0000<END
 
#0400
<CNP0600:0016:0000<END
 
Jan 29, 2014 at 4:48 AM
Junior Member
"Fresh from the Bakery"
Join Date: Jan 19, 2014
Location:
Posts: 16
I'm about to go read through that, but off the bat I'm noticing that you have arg_handler in the defines and arg_handeler everywhere else. Which may be a source of some difficulties.

I'll edit when I'm finished

e: stuff is in a new post
 
Jan 29, 2014 at 6:01 AM
The TideWalker
Modding Community Discord Founder
"That dog!"
Join Date: Apr 5, 2013
Location: In my mind and of my body.
Posts: 1642
Age: 27
oh, I corrected that on the fly when I posed it so I wouldn't look like an idiot.

*fails*

Anyway, thanks.
 
Jan 29, 2014 at 7:01 AM
Junior Member
"Fresh from the Bakery"
Join Date: Jan 19, 2014
Location:
Posts: 16
aaaaaaaand here we are. sorry about that taking a while.
I'm not entirely sure what your exact issue was because I got bored bugchecking and made my own version instead
Code:
(omitted: code to check RNJ-ness)

mov eax,[4a5ae0]
add eax,4
push eax
call 421900			; number of choices into eax
add esp,4

push eax			; max value (number of events)
push 1				; min value
call 40f350			; random value into eax
add esp,8

imul eax,eax,5			; number of chars in xxxx:
add eax,4			; number of chars in <RNJ
mov edx,[4a5ae0]
add edx,eax			; get to loc of event#  
push edx  
call 421900			; event# into eax 
add esp,4    

push eax  
call 421af0			; jump to event 
add esp,4    

(omitted: jump to top)
And here's a file where I replaced xx1 with that code.

moral of the story: I'm awful at helping people but at least now you have a version that works ....?
you might also want to read through that code and see what things I did differently than you and why. mostly it's just efficiency stuff, but I also made it so that you can use <RNJ with any number of arguments.

welp. yeah.
tell me if you have any questions.
sorry again for not finding your bug.

e:
oh. you put the arguments in the wrong order for the random function. bigger one first, or else it'll crash. might not be the only error in your code, but it's enough to break it.
 
Jan 29, 2014 at 2:26 PM
The TideWalker
Modding Community Discord Founder
"That dog!"
Join Date: Apr 5, 2013
Location: In my mind and of my body.
Posts: 1642
Age: 27
aaaaaaaand here we are. sorry about that taking a while.
I'm not entirely sure what your exact issue was because I got bored bugchecking and made my own version instead
Code:
(omitted: code to check RNJ-ness)

mov eax,[4a5ae0]
add eax,4
push eax
call 421900			; number of choices into eax
add esp,4

push eax			; max value (number of events)
push 1				; min value
call 40f350			; random value into eax
add esp,8

imul eax,eax,5			; number of chars in xxxx:
add eax,4			; number of chars in <RNJ
mov edx,[4a5ae0]
add edx,eax			; get to loc of event#  
push edx  
call 421900			; event# into eax 
add esp,4    

push eax  
call 421af0			; jump to event 
add esp,4    

(omitted: jump to top)
And here's a file where I replaced xx1 with that code.

moral of the story: I'm awful at helping people but at least now you have a version that works ....?
you might also want to read through that code and see what things I did differently than you and why. mostly it's just efficiency stuff, but I also made it so that you can use <RNJ with any number of arguments.

welp. yeah.
tell me if you have any questions.
sorry again for not finding your bug.

e:
oh. you put the arguments in the wrong order for the random function. bigger one first, or else it'll crash. might not be the only error in your code, but it's enough to break it.


Thank you sir, It works perfectly.



YOU are the man.
 
Jan 29, 2014 at 3:59 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
Pronouns: he/him
if you're making a command to jump based on random values why not just use the <VAR tsc command pack I wrote
 
Jan 29, 2014 at 5:28 PM
The TideWalker
Modding Community Discord Founder
"That dog!"
Join Date: Apr 5, 2013
Location: In my mind and of my body.
Posts: 1642
Age: 27
Cause I can't get it to work.

E: and last time I checked, you weren't supporting them so I didn't bother.
 
Jan 31, 2014 at 2:08 AM
leader of the meme team feat. tom, snaf and polad
"Wacka-Wacka-Wacka-Wacka-Wacka-Wacka-Wacka-Wacka-BLEIUP"
Join Date: Jan 24, 2014
Location: Polar✪
Posts: 301
Pronouns: he/him
Simple question time! Is it possible to change the Main Menu theme to an existing song without a resource hacker?
 
Jan 31, 2014 at 2:56 AM
Sincerity will always triumph over irony.
Modding Community Discord Admin
"What're YOU lookin' at?"
Join Date: Apr 23, 2013
Location: In a cave above the surface.
Posts: 1079
Age: 26
Pronouns: He/Him
PolarStarGames said:
Simple question time! Is it possible to change the Main Menu theme to an existing song without a resource hacker?
Yes, with Assembly hacking and This guide for finding the value to be edited.
 
Jan 31, 2014 at 7:20 AM
Junior Member
"Fresh from the Bakery"
Join Date: Jan 19, 2014
Location:
Posts: 16
^ That, or open up the exe with a hex editor and change the 24 at 0xfe80 to the id of whatever song you want to play
 
Feb 1, 2014 at 4:41 AM
The TideWalker
Modding Community Discord Founder
"That dog!"
Join Date: Apr 5, 2013
Location: In my mind and of my body.
Posts: 1642
Age: 27
Is there anyway to get CS to read .png files?

(No, It's not about file size, it's about transparency)
 
Feb 1, 2014 at 5:18 AM
Junior Member
"Fresh from the Bakery"
Join Date: Jan 19, 2014
Location:
Posts: 16
Not really, no.
You'd have to rewrite the graphics functions completely, and that's a bit of an ambitious project.
 
Feb 1, 2014 at 7:40 AM
Lvl 1
Forum Moderator
"Life begins and ends with Nu."
Join Date: May 28, 2008
Location: PMMM MMO
Posts: 3713
Age: 32
bigbadwoof said:
Not really, no.
You'd have to rewrite the graphics functions completely, and that's a bit of an ambitious project.
Actually you'd just have to rewrite the functions that load in the images. When pngs and stuff are loaded in, they are normally decoded into what is basically their BMP format.

It's not really a thing I would recommend you looking into though, since compressed image formats are sort of complicated.

Also if you wanted the alpha (partial transparency) to work from pngs then yeah that would require some rewriting to the graphics/drawing functions, probably.
 
Back
Top