Kuribo64
Views: 7,705,551 Home | Forums | Uploader | Wiki | Object databases | IRC
Rules/FAQ | Memberlist | Calendar | Stats | Online users | Last posts | Search
11-21-17 08:35 PM
Guest:

0 users reading [Tutorial] How to Replace Mario's Model with a Custom Model | 1 bot

Main - General SM64DS hacking - [Tutorial] How to Replace Mario's Model with a Custom Model New reply

Pages: 1 2 3
Fiachra
Posted on 02-20-16 05:41 AM Link | #67898
Yes, it's possible with ASM hacking, I've done it in my hack. You need to:
1. Use a texture to colour your model rather than vertex colours.
2. When importing, include additional textures that can be swapped to change their colour.
3. Find where the BMD loading method 0x02016FD4 is called for your object. Immediately afterwards r1 will contain the address of the loaded BMD model.
4. Place a hook at this location.
5. Parse the BMD to find the material which uses the texture used for colouring.
6. Modify the texture and palette ID's used by that material eg. depending on the object's parameters stored at +0x08, +0x8C, +0x90 for parameters 1, 2 and 3 respectively.

Here's some sample code which may be used to change texture ID's based on an object's parameter:
unsigned int ObjectAddress = 0xFFFFFFFF;
unsigned int BMDAddress = 0xFFFFFFFF;
// Replace XXXXXXXX with the address just after the call to 0x02016FD4 and YY with the overlay in which that address is contained
void hook_XXXXXXXX_ov_YY()
{
asm
(
"ldr r2, =ObjectAddress \t\n"
"str r4, [r2] \t\n" // In my case r4 held the object's address but this will differ
"ldr r2, =BMDAddress \t\n"
"str r1, [r2] \t\n"
);

byte param01 = *((volatile byte*)(ObjectAddress + 0x08));

bool isRed = ((param01 & 0x0F) == 0x01);

int textureID, paletteID;
textureID = paletteID = (isRed) ? 1 : 0;

int nMaterials = *((volatile int*)(BMDAddress + 0x24));
unsigned int offMaterials = *((volatile unsigned int*)(BMDAddress + 0x28));

unsigned int adrMaterial = offMaterials;
for (int i = 0; i < nMaterials; i++)
{
*((volatile int*)(adrMaterial + 0x04)) = textureID;
*((volatile int*)(adrMaterial + 0x08)) = paletteID;
adrMaterial += 48;
}
}

pacmainia&luigi
Posted on 02-21-16 01:15 PM Link | #67942
okay I think I got the first step, but I don't exactly understand the others. I'm a bit rusty, as I haven't worked on my hack for a couple of weeks.

____________________
Waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka.........

8PurpleThief
Posted on 02-21-16 05:38 PM (rev. 2 of 02-21-16 05:39 PM) Link | #67954
i'm no SM64DS hAxOr, but this is a neat tutorial for other HaXoRs.


____________________
Man, the mods SURE are strict around here.
(that doesn't mean i despise them, i just think they should just ban people
for REAL reasons)
(also, they banned one of my machiminist buddies, seanklaskyn64)
DON'T KILL ME BUTTER

Fiachra
Posted on 02-22-16 02:06 PM (rev. 2 of 02-22-16 02:06 PM) Link | #67983
Assuming that you're using DAE, to include extra images you need to list them under <library_images>, reference them as a texture within an <effect> and then create <material>s that reference that <effect>:
...
<library_images>
<image id="img_1" name="img_1">
<init_from>img_1.png</init_from>
</image>
<image id="img_2" name="img_2">
<init_from>img_2.png</init_from>
</image>
<image id="img_3" name="img_3">
<init_from>img_3.png</init_from>
</image>
</library_images>
...
<library_effects>
<effect id="mat_1-effect">
<profile_COMMON>
<newparam sid="img_1-surface">
<surface type="2D">
<init_from>img_1</init_from>
</surface>
</newparam>
<newparam sid="img_1-sampler">
<sampler2D>
<source>img_1-surface</source>
</sampler2D>
</newparam>
<technique sid="common">
<phong>
<diffuse>
<texture texture="img_1-sampler" texcoord="UVMap"/>
</diffuse>
</phong>
</technique>
</profile_COMMON>
</effect>
...
</library_effects>
...
<library_materials>
<material id="mat_1" name="mat_1">
<instance_effect url="#mat_1-effect"/>
</material>
</library_materials>
...
For the rest you'll need to become familiar with assembly hacking. No$gba debug version is the best tool to use.

pacmainia&luigi
(post deleted) #68511

pacmainia&luigi
Posted on 03-18-16 08:57 PM (rev. 2 of 03-18-16 08:58 PM) Link | #68861
Did what you said. Is this supposed to happen?
[thumbnail]
[thumbnail]
(above post deleted because misclicked and hit "delete button)

____________________
Waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka.........

Fiachra
Posted on 03-19-16 05:34 AM Link | #68868
Did you follow: "Export your model to DAE, ensuring to check the option "Include Material Textures"" properly?

pacmainia&luigi
Posted on 03-20-16 06:17 PM Link | #68936
Posted by Fiachra
Did you follow: "Export your model to DAE, ensuring to check the option "Include Material Textures"" properly?

Yeah, I think I did... But I'll try again tomorrow.

____________________
Waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka.........

Fiachra
Posted on 03-22-16 04:16 AM Link | #69005
If it's still not working, check that the file names are correct in the <library_images> element.

pacmainia&luigi
Posted on 03-26-16 06:13 PM (rev. 3 of 03-28-16 05:39 AM by Fiachra) Link | #69113
I tried what you said again, and included "Include Material Textures", but the editor gave me the following error message:
[thumbnail]

____________________
Waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka.........

Fiachra
Posted on 03-28-16 05:40 AM Link | #69181
You didn't do it correctly; if the "images" folder is within the same folder as the DAE model then the path should be "images/monte_tex_r_VFLIP.png".

EQUILIBRIUM
Posted on 08-29-16 07:47 AM Link | #76626
Hello, I am french and i verry not good in english X/ , please your traduction this tutoriel in french : )

StapleButter
Posted on 08-29-16 07:57 AM Link | #76627
Google Translate, sir

____________________
NSMBHD - Kafuka - Jul

what do you use to measure bolts? a boltmeter

Sparsite
Posted on 08-29-16 08:07 AM Link | #76628
Posted by EQUILIBRIUM
Hello, I am french and i verry not good in english X/ , please your traduction this tutoriel in french : )


Also, why are you asking him as if he knows french? (maybe he does, I dont know, but most don't). As staple said, google translate.

____________________
ASMR:
*quietly whispers*
move r0 r7
push r4 to r14
load register r4 into r0
POP

pacmainia&luigi
Posted on 08-29-16 11:02 AM Link | #76632
Posted by Fiachra
You didn't do it correctly; if the "images" folder is within the same folder as the DAE model then the path should be "images/monte_tex_r_VFLIP.png".

Okay. I did everything you said except for the asm step. it looks fine in the editor, but in game it looks like all the textures are black, like that level issue I had earlier. Is it supposed to be like that?

____________________
Waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka.........

pacmainia&luigi
Posted on 10-25-16 04:33 PM Link | #79173
Posted by Fiachra
No$gba debug version is the best tool to use.

is there, like, a tutorial somewhere that teaches how to use it?


____________________
Waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka.........

Sparsite
Posted on 10-25-16 07:14 PM Link | #79180
Posted by pacmainia&luigi
is there, like, a tutorial somewhere that teaches how to use it?


All documentation comes within the program itself for quick and eays to access references.

____________________
ASMR:
*quietly whispers*
move r0 r7
push r4 to r14
load register r4 into r0
POP

pacmainia&luigi
Posted on 01-08-17 01:56 PM Link | #80844
Posted by Fiachra
For the rest you'll need to become familiar with assembly hacking

Anywhere I can learn it? Like a tutorial or something?

____________________
Waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka.........

mibts
Posted on 01-08-17 03:09 PM Link | #80847
Here is a link to the ASM patch template, which allows making hacks with C or C++. It has an example and a tutorial.

____________________
Current hack: Excerpt from Super Mario 256

Any map on a flat torus can be colored with at most 7 colors.

pacmainia&luigi
Posted on 01-13-17 03:47 PM Link | #80915
Posted by Fiachra
3. Find where the BMD loading method 0x02016FD4 is called for your object. Immediately afterwards r1 will contain the address of the loaded BMD model.

Okay.. I'm assuming this is the step that requires no$gba. how do i find the address?

____________________
Waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka waka.........
Pages: 1 2 3

Main - General SM64DS hacking - [Tutorial] How to Replace Mario's Model with a Custom Model New reply

Page rendered in 0.071 seconds. (2048KB of memory used)
MySQL - queries: 28, rows: 231/231, time: 0.043 seconds.
[powered by Acmlm] Acmlmboard 2.064 (2015-10-07)
© 2005-2008 Acmlm, Xkeeper, blackhole89 et al.