Register - Login
Views: 95199382
Main - Memberlist - Active users - Calendar - Wiki - IRC Chat - Online users
Ranks - Rules/FAQ - Stats - Latest Posts - Color Chart - Smilies
09-23-18 05:45:32 PM

Jul - SM64 Hacking (Archive) - Correctly Compilling C For Usage With N64 New poll - New thread - New reply
Pages: 1 2Next newer thread | Next older thread
Cajetan
Member
Level: 20


Posts: 35/86
EXP: 40706
For next: 1733

Since: 08-06-11

From: Binary

Since last post: 3.0 years
Last activity: 1.0 years

Posted on 03-01-12 12:55:26 PM (last edited by Cajetan at 03-01-12 02:51 PM) Link | Quote
Originally posted by ShenoxVII

Lol hey tarek, haven't talked to you since I met you randomly on kaillera like a couple of years ago, and before that when we were hacking that kiddy game. If you are the person i think you are, German.

Btw, NICE tutorial, I love it thanks for doing this its a huge break through for progress in the sm64 hacking world, hopefully this will gain popularity of more complex hacks and now dealing with actual languages with the rom, so we can build off of it.

This, is great.


Ah that was you? I never knew that. However, you actually should thank Messiaen. He's the one that even found this possibility. I did just write a tutorial how to use it. Btw, im going to update it. Also, we should not getting off-topic. This topic is actually about C usage.

Oh, i nearly forgot: Messiaen is there any way to edit the Dialog text without using the Text Wrangler? I work currently on some project, which i need some way to edit the dialog text in my C file without using the Text Wrangler.
Kenshi
Member
Level: 20


Posts: 62/75
EXP: 41212
For next: 1227

Since: 09-15-07

From: NY

Since last post: 3.0 years
Last activity: 2.0 years

Posted on 03-03-12 12:16:20 PM Link | Quote
Originally posted by Cajetan
Originally posted by ShenoxVII

Lol hey tarek, haven't talked to you since I met you randomly on kaillera like a couple of years ago, and before that when we were hacking that kiddy game. If you are the person i think you are, German.

Btw, NICE tutorial, I love it thanks for doing this its a huge break through for progress in the sm64 hacking world, hopefully this will gain popularity of more complex hacks and now dealing with actual languages with the rom, so we can build off of it.

This, is great.


Ah that was you? I never knew that. However, you actually should thank Messiaen. He's the one that even found this possibility. I did just write a tutorial how to use it. Btw, im going to update it. Also, we should not getting off-topic. This topic is actually about C usage.

Oh, i nearly forgot: Messiaen is there any way to edit the Dialog text without using the Text Wrangler? I work currently on some project, which i need some way to edit the dialog text in my C file without using the Text Wrangler.


I've read throughout the whole thread and yet I can't understand entirely what this does. What does Compiling C or use with the N64 allow you to do?
Cajetan
Member
Level: 20


Posts: 40/86
EXP: 40706
For next: 1733

Since: 08-06-11

From: Binary

Since last post: 3.0 years
Last activity: 1.0 years

Posted on 03-03-12 05:45:34 PM (last edited by Cajetan at 03-03-12 05:47 PM) Link | Quote
Originally posted by Kenshi

I've read throughout the whole thread and yet I can't understand entirely what this does. What does Compiling C or use with the N64 allow you to do?


The C coding allows you to access the RAM and let you modify it.
For example following code:



#include "n64.h"
#include "explode.h"

void _start(void) {
asm volatile("la $gp, _gp")
PrintXY(160, 160, "Hello World")
}



Now you are able to use the N64Toolchain and compile the following code into a GameShark code for Super Mario 64. Now you type in that GameShark and it will print "Hello World" on Super Mario 64 after Mario spawns at the outside of the castle.

Conclusion:
With C you are able to modify SM64's RAM Objects and compile them into GameShark code. I'm currently working on a SM64 Shop, which i need the right addresses for(RAM: Current Coin amount + changing Dialog text's etc. )

I also got the idea of making a website where others can upload their patches that include the GameShark Patch(yes, this is a bit more complicated. ) etc. But it's currently very hard for everyone to understand how to setup the N64 Toolchain and get everything working right. That's why i wrote the tutorial. If you wanna look at it, look at my signature. If you don't understand something ask it here or PM me.
Casis777
User
Level: 10


Posts: 8/19
EXP: 4173
For next: 241

Since: 10-10-11


Since last post: 5.0 years
Last activity: 4.0 years

Posted on 03-20-12 11:15:10 PM (last edited by Casis777 at 03-20-12 11:24 PM) Link | Quote
Originally posted by Kenshi
I've read throughout the whole thread and yet I can't understand entirely what this does. What does Compiling C or use with the N64 allow you to do?


You can pretty much make the game do whatever your imagination can come up with as long as it stays with the boundries of the N64's hardware/software limitations. Even then, hardware is honestly the only real limitation.


Originally posted by messian

1) Using pointers to alter things in RAM
- Reading/writing 8, 16 and 32-bit values (types u8, u16, u32 and floats)
- Converting simple Gameshark codes to C code

2) Reading data from the game: current level, number of stars
- Using conditionals to enhance simpler codes
- Making your code execute only on a specific level, or on a minimum number of stars

3) Acessing the Mario struct
- Pointer-to-pointer struct syntax and acessing members, ie (*Struct)->member
- Checking current and previous action
- Reading JoyPad input using & and == operators.

4) Detecting current collision type Mario is stepping
- Adding action to existing collision types
- Creating custom collision types

5) Acessing the Object Struct
- Basic variables: action, position, collision spheres & interaction, x/y/z speed, distance from Mario or from other object
- Deactivating (killing) objects
- Changing action based on object timers
- Changing current animation
- Checking behaviors
- Spawning child objects
- Segmented vs RAM pointers (SegmentedToVirtual function)
- Iterating through the object linked list to find an specific object.

6) DMA
- Copying data from the ROM to RAM



I could probably help write most of those tutorials besides section 4 because I wouldn't know what RAM addresses to work with. I could start by monitoring what reads Mario's XYZ coordinates, though.

Also, section 5 would seem a bit too complex for me. All I know of RAM segments is what I have learned from hacking OoT on various occations:

Originally posted by Z64 Wiki

80166FA8(u32)[(number of segments)] Segment table, value|0x80000000 = ram addr
char * segments[8] = 0x80166FA8;

Example: Segment 0x6 would be pointed to at 0x80166FC0 ( 0x6 << 2 = 0x18 + 0x80166FA8 = 0x80166FC0 )
Note: the table is for the engine's reference only, so it is not reliable at all times, it is only updated when the game needs to update it, but not necessarily as the banks are updated. Also, it does not have banks 8 - 15. Segments values are:

0 - unknown
1 - unknown
2 - scene
3 - map
4 - gameplay_keep
5 - gameplay_field_keep (outside of dungeons), or gameplay_dangeon_keep (dungeons)
6 - current object
7 - unknown/link_animetion
8+ determined by current game circumstances.


Rena

Star Mario
Fennel
Level: 128


Posts: 4656/5257
EXP: 24350340
For next: 31360

Since: 07-22-07

Pronouns: he/him/whatever
From: RSP Segment 6

Since last post: 2 days
Last activity: 2 days

Posted on 04-03-12 04:48:32 AM Link | Quote
You can do anything with C that you can do with an ASM hack. Really, the compiler just translates your C code into ASM. The original games would have been written with C/C++, so you're essentially reprogramming them.
DamiHack
GO AWAY
Level: 11


Posts: 12/23
EXP: 5621
For next: 364

Since: 08-14-11


Since last post: 5.0 years
Last activity: 1.0 years

Posted on 04-06-12 01:34:54 PM Link | Quote
Does anyone know how to convert nemu64's codes into Project64's code or into normal GS code?
Casis777
User
Level: 10


Posts: 9/19
EXP: 4173
For next: 241

Since: 10-10-11


Since last post: 5.0 years
Last activity: 4.0 years

Posted on 04-15-12 11:08:18 PM Link | Quote
Originally posted by Rena
You can do anything with C that you can do with an ASM hack. Really, the compiler just translates your C code into ASM. The original games would have been written with C/C++, so you're essentially reprogramming them.


True that, but many find it harder to write code in assembly language (low-level).

Originally posted by DamiHack
Does anyone know how to convert nemu64's codes into Project64's code or into normal GS code?



I would imagine a program exists that does it for you. If not, then it should be relatively simple to program myself. BUT, if you're converting a hack you made in C or assembly into a GS code, simply change the makefile to not have it run the program "nemucheat".
DamiHack
GO AWAY
Level: 11


Posts: 14/23
EXP: 5621
For next: 364

Since: 08-14-11


Since last post: 5.0 years
Last activity: 1.0 years

Posted on 04-20-12 09:39:50 AM Link | Quote
Originally posted by Casis777
Originally posted by Rena
You can do anything with C that you can do with an ASM hack. Really, the compiler just translates your C code into ASM. The original games would have been written with C/C++, so you're essentially reprogramming them.


True that, but many find it harder to write code in assembly language (low-level).

Originally posted by DamiHack
Does anyone know how to convert nemu64's codes into Project64's code or into normal GS code?



I would imagine a program exists that does it for you. If not, then it should be relatively simple to program myself. BUT, if you're converting a hack you made in C or assembly into a GS code, simply change the makefile to not have it run the program "nemucheat".


I tried, but it doesn't work; how can I do this?!
Pages: 1 2Next newer thread | Next older thread
Jul - SM64 Hacking (Archive) - Correctly Compilling C For Usage With N64 New poll - New thread - New reply




Rusted Logic

Acmlmboard - commit 5d36857 [2018-03-03]
©2000-2018 Acmlm, Xkeeper, Inuyasha, et al.

29 database queries, 2 query cache hits.
Query execution time: 0.162807 seconds
Script execution time: 0.024050 seconds
Total render time: 0.186858 seconds
Memory used: 1048576