(01-26-2023, 12:06 AM)Vega Wrote: He's saying the mini map has to be turned on first regardless. This does not mean its actually visible. You will then have to modify the visibility property of the mini map, which I assumed can be done at any frame/time.
Regarding your Assembly questions about r3, r31, and what not~
r3 thru r10 are the parameter (volatile) registers. They are used as inputs/arguments for functions. They are also used as return values given back by functions to let you know how a function went (failed, succeeded, denied, etc). The Caller (whatever code responsible for actually calling a function) is responsible for setting up the args. The Callee (function itself) will return output(s) in the parameter registers back to the Caller.
For 99.9% of functions, r3 will contain the return value/output. For float based functions, return value is in f1. There are a handful of functions that will need to use r4+ or f2+ for extra return values, but this is really rare. For a majority a functions, a negative value indicates an error.
r31 is a non-volatile register, aka global variable register (GVR for short). GVRs are r14 thru r31. These are saved thru out function calls. A function may save args given by the Caller into the GVRs so a later child function(s) can use or modify them. GVRs that need to be preserved the longest are kept in the lower range of r14 thru r31, while GVRs that need to be used/modified/etc in a relatively short manner are in the higher range of r14 thru r31.
Example of using GVRs to save items throughout function calls. Just made up a template with fake args and functions for demonstration. Take note of the two instructions that have comments attached
li r3, 1
li r4, 0
bl function_a
mr. r31, r3 ####Do a cmpwi r31, 0 to see if initial r3 was less than zero, place r3 into r31 GVR
blt- error
lis r4, 0x8085
ori r4, r4, 0xC000
bl function_b
cmpwi r3, 0x1000
bne+ error
mr r3, r31 ###Return value of function_a is arg for function_c
bl function_c
Regarding your specific source, keep in mind that you can implement conditional branches to the LR/CTRÂ
Example:
cmplwi r3, 1200
bgtlr+
For bge/bgt/ble/blt branches after a comparison, you should be using logical comparisons (i.e. cmplwi). Unless... you are expecting the possibility of values in the 0x80000000 thru 0xFFFFFFFF range to be present and you want said values to be treated as negative (signed).
You also can use other CRs (cr5, cr6, cr7) for doing consecutive compares.
Example:
cmplwi r3, 1200
cmplwi cr7, r3, 1
...
...
bgt+ somewhere
blt- cr7, somewhere_else
The Broadway Manual and PPC Compiler Writer's Guide are the 2 best docs to read up on btw
They are provided in this download - https://mariokartwii.com/downloads/PPCManuals.zip
Thank you for your in depth explanation. This cleared up some bits.
I haven't worked that much with ASM before and some tutorials use a lot of technical terms and words without any examples. At times, this can be quite frustrating for a beginner.
What I understood for my issue is, that I need to find out the bit of the map and then manually use the logic in c to call a procedure in ASM to change the visibility of the map.
I have found this thread by CLF78: https://mariokartwii.com/showthread.php?...ht=minimap
So
Code:
047EA498 38000000
Would completely hide the map and
Code:
047EA498 38000064
restore it to its original opacity.
So it's writing 38000064 at address 0x847EA498. What I haven't figure out yet: How could I translate that into ASM?