Register - Login
Views: 99380371
Main - Memberlist - Active users - Calendar - Wiki - IRC Chat - Online users
Ranks - Rules/FAQ - Stats - Latest Posts - Color Chart - Smilies
04-23-22 11:25:13 PM
Jul - SM64 Hacking (Archive) - Correctly Compilling C For Usage With N64 New poll - New thread - New reply
Pages: 1 2 Next newer thread | Next older thread
Cajetan
Member
Level: 22


Posts: 35/88
EXP: 51640
For next: 6710

Since: 08-06-11

From: Binary

Since last post: 345 days
Last activity: 345 days

Posted on 03-01-12 03: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: 21


Posts: 62/75
EXP: 47437
For next: 2506

Since: 09-15-07

From: NY

Since last post: 6.9 years
Last activity: 6.2 years

Posted on 03-03-12 03: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?

____________________
This is a sig.
Cajetan
Member
Level: 22


Posts: 40/88
EXP: 51640
For next: 6710

Since: 08-06-11

From: Binary

Since last post: 345 days
Last activity: 345 days

Posted on 03-03-12 08: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.

____________________
http://sites.google.com/site/cajetan64/home/coding-in-n64-with-c

- Click there to learn more about C coding and writing your own codes for Super Mario 64.
Casis777
User
Level: 11


Posts: 8/19
EXP: 5137
For next: 848

Since: 10-10-11


Since last post: 8.8 years
Last activity: 8.6 years

Posted on 03-21-12 02:15:10 AM (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
I had one (1) message in Discord deleted and proceeded to make a huge, huge mess about how it was a violation of free speech and how moderators are supposed to be spam janitors and nobody should have the right to tell me not to talk about school shootings
Level: 135


Posts: 4656/5390
EXP: 29050451
For next: 284554

Since: 07-22-07

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

Since last post: 333 days
Last activity: 333 days

Posted on 04-03-12 07:48:32 AM Link | Quote
Post #4656 · 04-03-12 02:48:32 AM
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: 12


Posts: 12/23
EXP: 6893
For next: 1028

Since: 08-14-11


Since last post: 8.7 years
Last activity: 65 days

Posted on 04-06-12 04: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: 11


Posts: 9/19
EXP: 5137
For next: 848

Since: 10-10-11


Since last post: 8.8 years
Last activity: 8.6 years

Posted on 04-16-12 02:08:18 AM 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: 12


Posts: 14/23
EXP: 6893
For next: 1028

Since: 08-14-11


Since last post: 8.7 years
Last activity: 65 days

Posted on 04-20-12 12:39:50 PM 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 2 Next 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 47be4dc [2021-08-23]
©2000-2022 Acmlm, Xkeeper, Kaito Sinclaire, et al.

31 database queries, 2 query cache hits.
Query execution time:  0.083252 seconds
Script execution time:  0.017319 seconds
Total render time:  0.100571 seconds


TidyHTML vomit below
line 1 column 1 - Warning: missing <!DOCTYPE> declaration
line 2 column 233 - Warning: unescaped & or unknown entity "&page"
line 119 column 11 - Warning: <form> isn't allowed in <table> elements
line 118 column 10 - Info: <table> previously mentioned
line 120 column 11 - Warning: missing <tr>
line 120 column 119 - Warning: missing </font> before </td>
line 124 column 16 - Warning: plain text isn't allowed in <tr> elements
line 120 column 11 - Info: <tr> previously mentioned
line 125 column 68 - Warning: missing </nobr> before </td>
line 141 column 68 - Warning: missing </nobr> before <tr>
line 147 column 35 - Warning: missing <tr>
line 147 column 50 - Warning: missing </font> before </td>
line 148 column 37 - Warning: unescaped & or unknown entity "&id"
line 147 column 212 - Warning: missing </font> before </table>
line 149 column 35 - Warning: missing <tr>
line 149 column 95 - Warning: unescaped & or unknown entity "&page"
line 149 column 50 - Warning: missing </font> before </td>
line 149 column 132 - Warning: missing </font> before </table>
line 156 column 9 - Warning: <div> isn't allowed in <table> elements
line 152 column 17 - Info: <table> previously mentioned
line 158 column 9 - Warning: missing <tr>
line 176 column 13 - Warning: missing <tr>
line 177 column 102 - Warning: unescaped & or unknown entity "&postid"
line 191 column 9 - Warning: <div> isn't allowed in <table> elements
line 152 column 17 - Info: <table> previously mentioned
line 193 column 9 - Warning: missing <tr>
line 211 column 13 - Warning: missing <tr>
line 212 column 102 - Warning: unescaped & or unknown entity "&postid"
line 228 column 9 - Warning: <div> isn't allowed in <table> elements
line 152 column 17 - Info: <table> previously mentioned
line 230 column 9 - Warning: missing <tr>
line 248 column 13 - Warning: missing <tr>
line 249 column 102 - Warning: unescaped & or unknown entity "&postid"
line 277 column 9 - Warning: <div> isn't allowed in <table> elements
line 152 column 17 - Info: <table> previously mentioned
line 279 column 9 - Warning: missing <tr>
line 297 column 13 - Warning: missing <tr>
line 298 column 102 - Warning: unescaped & or unknown entity "&postid"
line 361 column 9 - Warning: <div> isn't allowed in <table> elements
line 152 column 17 - Info: <table> previously mentioned
line 363 column 9 - Warning: missing <tr>
line 381 column 13 - Warning: missing <tr>
line 382 column 102 - Warning: unescaped & or unknown entity "&postid"
line 384 column 4760 - Warning: replacing unexpected input with </input>
line 384 column 5074 - Warning: discarding unexpected </span>
line 387 column 9 - Warning: <div> isn't allowed in <table> elements
line 152 column 17 - Info: <table> previously mentioned
line 389 column 9 - Warning: missing <tr>
line 407 column 13 - Warning: missing <tr>
line 408 column 102 - Warning: unescaped & or unknown entity "&postid"
line 413 column 9 - Warning: <div> isn't allowed in <table> elements
line 152 column 17 - Info: <table> previously mentioned
line 415 column 9 - Warning: missing <tr>
line 433 column 13 - Warning: missing <tr>
line 434 column 102 - Warning: unescaped & or unknown entity "&postid"
line 446 column 9 - Warning: <div> isn't allowed in <table> elements
line 152 column 17 - Info: <table> previously mentioned
line 448 column 9 - Warning: missing <tr>
line 466 column 13 - Warning: missing <tr>
line 467 column 102 - Warning: unescaped & or unknown entity "&postid"
line 481 column 17 - Warning: missing <tr>
line 481 column 17 - Warning: discarding unexpected <table>
line 484 column 35 - Warning: missing <tr>
line 484 column 95 - Warning: unescaped & or unknown entity "&page"
line 484 column 50 - Warning: missing </font> before </td>
line 484 column 132 - Warning: missing </font> before </table>
line 486 column 35 - Warning: missing <tr>
line 486 column 50 - Warning: missing </font> before </td>
line 487 column 37 - Warning: unescaped & or unknown entity "&id"
line 486 column 212 - Warning: missing </font> before </table>
line 488 column 17 - Warning: discarding unexpected </textarea>
line 488 column 28 - Warning: discarding unexpected </form>
line 488 column 35 - Warning: discarding unexpected </embed>
line 488 column 43 - Warning: discarding unexpected </noembed>
line 488 column 53 - Warning: discarding unexpected </noscript>
line 488 column 64 - Warning: discarding unexpected </noembed>
line 488 column 74 - Warning: discarding unexpected </embed>
line 488 column 82 - Warning: discarding unexpected </table>
line 488 column 90 - Warning: discarding unexpected </table>
line 490 column 9 - Warning: missing </font> before <table>
line 502 column 25 - Warning: discarding unexpected </font>
line 511 column 57 - Warning: discarding unexpected </font>
line 489 column 1 - Warning: missing </center>
line 120 column 63 - Warning: <img> lacks "alt" attribute
line 125 column 19 - Warning: <td> attribute "width" has invalid value "120px"
line 125 column 93 - Warning: <img> lacks "alt" attribute
line 141 column 19 - Warning: <td> attribute "width" has invalid value "120px"
line 141 column 98 - Warning: <img> lacks "alt" attribute
line 148 column 44 - Warning: <img> proprietary attribute value "absmiddle"
line 148 column 142 - Warning: <img> proprietary attribute value "absmiddle"
line 148 column 246 - Warning: <img> proprietary attribute value "absmiddle"
line 161 column 22 - Warning: <img> lacks "alt" attribute
line 161 column 63 - Warning: <img> lacks "alt" attribute
line 161 column 112 - Warning: <img> lacks "alt" attribute
line 161 column 162 - Warning: <img> lacks "alt" attribute
line 162 column 11 - Warning: <img> lacks "alt" attribute
line 172 column 15 - Warning: <img> lacks "alt" attribute
line 196 column 22 - Warning: <img> lacks "alt" attribute
line 196 column 63 - Warning: <img> lacks "alt" attribute
line 196 column 112 - Warning: <img> lacks "alt" attribute
line 196 column 162 - Warning: <img> lacks "alt" attribute
line 197 column 11 - Warning: <img> lacks "alt" attribute
line 207 column 15 - Warning: <img> lacks "alt" attribute
line 233 column 22 - Warning: <img> lacks "alt" attribute
line 233 column 63 - Warning: <img> lacks "alt" attribute
line 233 column 112 - Warning: <img> lacks "alt" attribute
line 233 column 162 - Warning: <img> lacks "alt" attribute
line 234 column 11 - Warning: <img> lacks "alt" attribute
line 244 column 15 - Warning: <img> lacks "alt" attribute
line 282 column 22 - Warning: <img> lacks "alt" attribute
line 282 column 63 - Warning: <img> lacks "alt" attribute
line 282 column 112 - Warning: <img> lacks "alt" attribute
line 282 column 162 - Warning: <img> lacks "alt" attribute
line 293 column 15 - Warning: <img> lacks "alt" attribute
line 366 column 23 - Warning: <img> lacks "alt" attribute
line 366 column 64 - Warning: <img> lacks "alt" attribute
line 366 column 113 - Warning: <img> lacks "alt" attribute
line 366 column 163 - Warning: <img> lacks "alt" attribute
line 377 column 15 - Warning: <img> lacks "alt" attribute
line 392 column 22 - Warning: <img> lacks "alt" attribute
line 392 column 63 - Warning: <img> lacks "alt" attribute
line 392 column 112 - Warning: <img> lacks "alt" attribute
line 392 column 162 - Warning: <img> lacks "alt" attribute
line 393 column 11 - Warning: <img> lacks "alt" attribute
line 403 column 15 - Warning: <img> lacks "alt" attribute
line 418 column 22 - Warning: <img> lacks "alt" attribute
line 418 column 63 - Warning: <img> lacks "alt" attribute
line 418 column 112 - Warning: <img> lacks "alt" attribute
line 418 column 162 - Warning: <img> lacks "alt" attribute
line 429 column 15 - Warning: <img> lacks "alt" attribute
line 451 column 22 - Warning: <img> lacks "alt" attribute
line 451 column 63 - Warning: <img> lacks "alt" attribute
line 451 column 112 - Warning: <img> lacks "alt" attribute
line 451 column 162 - Warning: <img> lacks "alt" attribute
line 452 column 11 - Warning: <img> lacks "alt" attribute
line 462 column 15 - Warning: <img> lacks "alt" attribute
line 487 column 44 - Warning: <img> proprietary attribute value "absmiddle"
line 487 column 142 - Warning: <img> proprietary attribute value "absmiddle"
line 487 column 246 - Warning: <img> proprietary attribute value "absmiddle"
line 496 column 25 - Warning: <img> lacks "alt" attribute
line 501 column 267 - Warning: <img> lacks "alt" attribute
line 384 column 4827 - Warning: trimming empty <label>
line 481 column 17 - Warning: trimming empty <tr>
line 125 column 68 - Warning: <nobr> is not approved by W3C
line 141 column 68 - Warning: <nobr> is not approved by W3C
line 177 column 27 - Warning: <nobr> is not approved by W3C
line 212 column 27 - Warning: <nobr> is not approved by W3C
line 249 column 27 - Warning: <nobr> is not approved by W3C
line 298 column 27 - Warning: <nobr> is not approved by W3C
line 382 column 27 - Warning: <nobr> is not approved by W3C
line 408 column 27 - Warning: <nobr> is not approved by W3C
line 434 column 27 - Warning: <nobr> is not approved by W3C
line 467 column 27 - Warning: <nobr> is not approved by W3C
Info: Document content looks like HTML5
Info: No system identifier in emitted doctype
Tidy found 143 warnings and 0 errors!


The alt attribute should be used to give a short description
of an image; longer descriptions should be given with the
longdesc attribute which takes a URL linked to the description.
These measures are needed for people using non-graphical browsers.

For further advice on how to make your pages accessible
see http://www.w3.org/WAI/GL.
You are recommended to use CSS to specify the font and
properties such as its size and color. This will reduce
the size of HTML files and make them easier to maintain
compared with using <FONT> elements.

You are recommended to use CSS to control line wrapping.
Use "white-space: nowrap" to inhibit wrapping in place
of inserting <NOBR>...</NOBR> into the markup.

About HTML Tidy: https://github.com/htacg/tidy-html5
Bug reports and comments: https://github.com/htacg/tidy-html5/issues
Official mailing list: https://lists.w3.org/Archives/Public/public-htacg/
Latest HTML specification: http://dev.w3.org/html5/spec-author-view/
Validate your HTML documents: http://validator.w3.org/nu/
Lobby your company to join the W3C: http://www.w3.org/Consortium

Do you speak a language other than English, or a different variant of
English? Consider helping us to localize HTML Tidy. For details please see
https://github.com/htacg/tidy-html5/blob/master/README/LOCALIZE.md