Kuribo64
Views: 23,105,666 Home | Forums | Uploader | Wiki | Object databases | IRC
Rules/FAQ | Memberlist | Calendar | Stats | Online users | Last posts | Search
12-06-24 08:10 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 Hide post layouts | New reply

Pages: 1 2 3
Fiachra
Posted on 02-20-16 10: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 06: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 10:38 PM (rev. 2 of 02-21-16 10: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 07:06 PM (rev. 2 of 02-22-16 07: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-19-16 12:57 AM (rev. 2 of 03-19-16 12:58 AM) 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 09: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 10: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 08: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 10:13 PM (rev. 3 of 03-28-16 09: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 09: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 11:47 AM Link | #76626
Hello, I am french and i verry not good in english X/ , please your traduction this tutoriel in french : )

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

____________________
NSMBHD - Kafuka - Jul
melonDS the most fruity DS emulator there is

zafkflzdasd

Sparsite
Posted on 08-29-16 12:07 PM 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 03:02 PM 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 08: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 11: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 06: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 08: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 08: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 Hide post layouts | New reply

Page rendered in 0.025 seconds. (2048KB of memory used)
MySQL - queries: 28, rows: 236/236, time: 0.009 seconds.
[powered by Acmlm] Acmlmboard 2.064 (2018-07-20)
© 2005-2008 Acmlm, Xkeeper, blackhole89 et al.