1
0
Fork 0

Merge branch 'master' of github.com:pristinesource/Super-Mario-Sunshine-C-Kit

This commit is contained in:
Matteias Collet 2021-01-14 23:01:17 +01:00
commit 451dde0d62
5 changed files with 2387 additions and 571 deletions

View file

@ -1,36 +1,36 @@
> Note: This repository was forked from MasterF0x whose GitHub Account disappeared and doesn't represent the code from the original repository 100% (it was about 8 commits ahead / 8 behind when the repository disappeared). If YOU happen to have a backup of the latest version from their original code please let me know.
# Super Mario Sunshine - C Kit
A C library for everyone's favorite game: Super Mario Sunshine. The tools in this will allow you to compile C code which can be patched into Super Mario Sunshine.
#What can this do?
## What can this do?
The library allows you to compile PPC code that replace functions and interact with objects in Super Mario Sunshine. The code can be either put into a gecko code with a max size of 229 lines or be patched into Super Mario Sunshine's Start.dol.
#Neato!... Well, how do I set this up?
## Neato!... Well, how do I set this up?
0. Clone or download the c kit.
0. Install devkitPro for PPC somewhere on your harddrive. The batch files are set up for it to be located at C:\devkitPro\devkitPPC, but you can edit the batch files to account for your install location.
0. If you want to patch Start.dol, extract it from your Super Mario Sunshine image and copy it into the c kit directory.
0. To compile C code, drag the source file onto build.bat for a gecko code or patchdol.bat to patch Start.dol.
0. The gecko code should be copied into your clipboard or a new .dol file with your source files name will be created.
1. Install devkitPro for PPC somewhere on your harddrive. The batch files are set up for it to be located at C:\devkitPro\devkitPPC, but you can edit the batch files to account for your install location.
2. If you want to patch Start.dol, extract it from your Super Mario Sunshine image and copy it into the c kit directory.
3. To compile C code, drag the source file onto build.bat for a gecko code or patchdol.bat to patch Start.dol.
4. The gecko code should be copied into your clipboard or a new .dol file with your source files name will be created.
#Alright. Do you have any examples to show?
#Alright. Do you have any examples to show?
Yes, actually. Here's an item spawning example from Miluaces:
Yes, actually. Here's an item spawning example from Miluaces:
```
include "sms.h"
int laststate; //Last state
int OnUpdate(MarDirector* director) {
int OnUpdate(MarDirector* director) {
int (*GameUpdate)(MarDirector* director) = GetObjectFunction(director, Director_GameUpdate);
MarioActor* mario = GetMarioHitActor();
ItemActor* item = 0;
if (!laststate){
if (ControllerOne->buttons & PRESS_DU) //Dpad up spawns a coin
item = MakeObjAppear(*gpItemManager, OBJ_COIN);
@ -41,36 +41,34 @@ int OnUpdate(MarDirector* director) {
else if (ControllerOne->buttons & PRESS_DD) //Dpad down spawns a turbo nozzle
item = MakeObjAppear(*gpItemManager, OBJ_TURBONOZZLE);
}
// If no dpad buttons are pressed, reset laststate
if (!(ControllerOne->buttons & (PRESS_DU | PRESS_DL | PRESS_DR | PRESS_DD)))
laststate = 0;
//If item was assigned, set it up
if (item != 0){
//Set laststate to 1 to prevent more than one item spawning from one button press
laststate = 1;
//Set item position
item->position.x = mario->position.x;
item->position.y = mario->position.y + 200.0f;
item->position.z = mario->position.z;
//Set item velocity
item->velocity.y = 20.0f;
//Make item moveable
item->flags = item->flags & ~ITEMFLAG_STATIC;
}
return GameUpdate(director);
}
```
There are more examples in the repository.
#My code compiled! What do I do now?
## My code compiled! What do I do now?
Either build a new SMS image with your dol file or enter your gecko code to see your code run in game.

1764
inc/sms.h

File diff suppressed because it is too large Load diff

View file

@ -9,5 +9,5 @@ C:\devkitPro\devkitPPC\bin\powerpc-eabi-objdump.exe obj_%~n1.o --full-content
if ERRORLEVEL 1 pause
if ERRORLEVEL 1 exit
C:\devkitPro\devkitPPC\bin\powerpc-eabi-objcopy.exe obj_%~n1.o %~n1.bin -O binary -R .eh_frame -R .comment -R .gnu.attributes -g -S
DolInsert.exe %~n1.bin -m %~n1.map -dol ./Start.dol -o %~n1.dol -c OnUpdate:0x802a6160:3 -c OnSetup:0x802998b8:0 -c OnDraw2D:0x80143f14:0 -c OnWaterHitsGround:0x8027f7dc:0 -c OnObjectTouchMario:0x801b02fc:3 -c OnAllNPCsUpdate:0x8003e2f0:0 -c OnSmallEnemyHitMario:0x8006c76c:3 -r EMarioControl:0x8004010c -r IsMario:0x8024db0c -r EMarioReceiveMessage:0x8003956c -r MarioSendMessage:0x80273870 -r EMarioPlayerControl:8004006c -c OnMarioIncHP:0x80282ee0:0x80282f04:0x80282f84:0x80283414:0x80283490:0x802834d4:0 -c OnMarioDecHP:0x80242b10:0 -r EMarioDamageExec:0x80040068 -r IsMultiplayerMap:0x802a8b30
DolInsert.exe %~n1.bin -m %~n1.map -dol ./Start.dol -o %~n1.dol -c OnUpdate:0x802a6160:3 -c OnSetup:0x802998b8:0 -c OnDraw2D:0x80143f14:0 -c OnWaterHitsGround:0x8027f7dc:0 -c OnObjectTouchMario:0x801b02fc:3 -c OnAllNPCsUpdate:0x8003e2f0:0 -c OnSmallEnemyHitMario:0x8006c76c:3 -r IsMario:0x8024db0c -r MarioSendMessage:0x80273870 -c OnMarioIncHP:0x80282ee0:0x80282f04:0x80282f84:0x80283414:0x80283490:0x802834d4:0 -c OnMarioDecHP:0x80242b10:0 -r IsMultiplayerMap:0x802a8b30 -c OnCheckActorsHit:0x80299af8:0 -c OnDetectHit:0x8021bfb4:0x8021bc00:0 -c OnMarioHeld:0x80284bd0:0 -c OnMarioThrow:0x802437bc:5 -c OnMarioDrop:0x8023f89c:3 -c OnChangeNozzle:0x80283204:0x80283154:0x802830a4:0 -c OnRideYoshi:0x8028121c:0 -r IsOnYoshi:0x802558c8 -r IsOnYoshi2:0x8024e2e4 -c OnDismountYoshi:0x8024dfc8:0x80270638:0 -c OnWaterGunUpdate:0x8024e2a0:0 -c OnUpdateMultiplayerCamera:0x80023860:0 -c CalcMultiplayerCameraPos:0x80030c04:0 -c CheckOtherObjectCollisions:0x8021bc08:1 -c CheckOtherObjectCollisions2:0x8021bba8:0 -c ChangeAllPlayerStatus:0x80240798:0x80240928:80240a2c:0 -c CreateYoshi:0x80276850:0 -c OnInitApp:0x8000561c:0 -c OnCameraMove:0x80023150:0
pause

113
smsFuncs
View file

@ -1,15 +1,29 @@
CARDInit = 0x803551a0;
CARDMount = 0x803588dc;
CARDOpen = 0x8035938c;
CARDCreate = 0x803598a8;
CARDRead = 0x80359d20;
CARDWrite = 0x8035a09c;
MarDirector_SetupObjects = 0x802b76f4;
PlaySound = 0x800189d4;
StartBGM = 0x80016978;
StopBGM = 0x8001686c;
StopBGMS = 0x80016740;
search = 0x80016d44;
searchPane = 0x802d0050;
StartStageEntranceDemoSeq = 0x802bb880;
GenerateEffectElectric = 0x80262e18;
GenerateEffectElectric = 0x80262E18;
MakeObjAppear = 0x801b6e3c;
makeShineAppearWithDemo = 0x801c018c;
SendMsgToMario = 0x80273870;
EmitSweat = 0x8026465c;
Mario_StartVoice = 0x8028537c;
Fludd_Emit = 0x80268f98;
SetMarioStatus = 0x80254034;
IsMarioJumping = 0x802739b4;
Mario_SetAnim = 0x80247670;
IsMarioDashing = 0x8027372c;
initAnimSound = 0x80012eb0;
setMarioAnim = 0x80247670;
ThrowMario = 0x80254200;
GetMarioMapPosition = 0x8007706c;
IncGoldCoinFlag = 0x80294610;
@ -20,16 +34,21 @@ GetMarioYoshi = 0x80273a00;
GetFLUDD = 0x802738c0;
GetMarioHitActor = 0x802739d4;
GetShineStage = 0x802a8ac8;
getGlbResource = 0x802c2fb0;
SearchF = 0x802fa7ac;
setSrcRect = 0x802f884c;
setFrameRate = 0x80238e7c;
ChangeStage = 0x8029a31c;
DrawWaterBackground = 0x801492a4;
DrawWaterBackground = 0x801492A4;
Talk2D_OpenWindow = 0x80150514;
Vector_Magnitude = 0x8022a414;
Vector_Normalize = 0x8022a43c;
Vector_Subtract = 0x80010ca0;
Vector_Add = 0x8034a56c;
Vector_Scale = 0x8034a5b4;
readData = 0x802c6178;
CalcKeyCode = 0x802fa4d8;
C_MTXLookAt = 0x80349f5c;
JUTRect_Set = 0x802ca1e0;
J2DScreen_Draw = 0x802cfda8;
J2DPane_MakeMatrix = 0x802cbbfc;
@ -49,8 +68,13 @@ J2DPrint_GetWidth = 0x802ce294;
J2DPrint_Create = 0x802cdc7c;
J2DGrafContext_Setup2D = 0x802eb6bc;
J2DOrthoGraph_Create = 0x802ecfcc;
JSURead = 0x802c5770;
GXInvalidateTexAll = 0x80360400;
GXSetProjection = 0x80362c34;
GXSetScissor = 0x80363138;
GXSetViewport = 0x803630c8;
GXFlush = 0x8035d8f0;
getDistance = 0x801b9068;
StampPollution = 0x8019de84;
CleanPollution = 0x8019ddb4;
Drama_PrepareUpdate = 0x802fcc94;
@ -68,10 +92,91 @@ Mario_PlayerControl = 0x8024de38;
Mario_DamageExec = 0x8024280c;
Mario_IncHP = 0x80243928;
Mario_DecHP = 0x80243828;
mario_initModel = 0x80246578;
mario_initValues = 0x802766b0;
EnemyMario_CheckController = 0x8004010c;
Camera_AddMultiPlayer = 0x80030cc0;
Camera_RemoveMultiPlayer = 0x80030c28;
Camera_CreateMultiPlayer = 0x80030d1c;
Mario_DrawHP = 0x8003fdc4;
IsPolluted = 0x801a12e8;
Mario_WearGlasses = 0x80247fa4;
Mario_WearGlasses = 0x80247fa4;
emitGetCoinEffect = 0x80264550;
emitGotEffect = 0x802645dc;
changeTexture = 0x802cc6a0;
setPanePosition = 0x8015508c;
setAnimSound = 0x80217a8c;
setTalkBox = 0x801515a0;
Destroy = 0x801b4114;
destroyCol = 0x801b1130;
objAppear = 0x801b0430;
openNormalTalkWindow = 0x80152fb0;
startCameraDemo = 0x80032a84;
coinTaken = 0x801bec88;
redCoinTaken = 0x801be428;
startAppearGo = 0x80171bb8;
updatePane = 0x8013ebf0;
updateBoundPane = 0x80154c98;
updateBlendPane = 0x8017900c;
movePane = 0x8013eeb0;
processAppearCoin = 0x80146104;
startAppearCoin = 0x8014c7e8;
processDownCoin = 0x801466f0;
initModelData = 0x801b1c34;
ObjHitCheck_CheckActorsHit = 0x8021b900;
ObjHitCheck_DetectHit = 0x8021c29c;
MapObjBase_RemoveMapCollision = 0x801b1130;
WaterGun_ChangeNozzle = 0x8026a164;
Mario_InitValues = 0x802766b0;
Mario_GetOffYoshi = 0x8024eb6c;
Mario_WaterGunUpdate = 0x8024e300;
Yoshi_Ride = 0x802703e8;
WaterGun_Create = 0x8026aa48;
WaterGun_Init = 0x8026a3bc;
WaterGun_Update = 0x8026971c;
ParticleManager_EmitWithRotate = 0x8028844c;
PolarSubCamera_UpdateMultiplayer = 0x800308b4;
CLBPolarToCross = 0x800289b4;
ModelWaterManager_EmitRequest = 0x8027fc84;
WaterEmitInfo_Create = 0x802806f4;
MapObjBase_EmitSplash = 0x801b8d34;
cosf = 0x8033c610;
sinf = 0x8033c630;
sqrtf = 0x800067e8;
PSMTXCopy = 0x803499bc;
marioCanTake = 0x80243550;
marioStartVoice = 0x8028537c;
getModel = 0x80218a50;
showAllShapePacket = 0x80235728;
makeObjAppeared = 0x801b0430;
startMapObjAnim = 0x801b09d4;
startSoundSystemSE = 0x80018864;
setBuffer = 0x802c6164;
createMActor = 0x8021cc74;
startAnimation = 0x80239e64;
setBTP = 0x80238898;
setUpMapCollision = 0x801b238c;
changeCollision = 0x8018e5e0;
startJAIStream = 0x80309504;
loadToMainRAM = 0x802ea8fc;
loadToARAM = 0x802ebba0;
loadModelData = 0x8021d5a4;
loadBCKDataBase = 0x802e8ca4;
DVDOpen = 0x8034b914;
DVDPrepareStreamASync = 0x8034beb0;
DVDStopStreamAtEndAsync = 0x8034de6c;
DVDCancelStreamAsync = 0x8034ddb0;
Mario_SetAnim = 0x80247670;
ThrowMario = 0x8007706c;
GetMarioStatus = 0x802738f0;
GetMarioHP = 0x80273674;
Mario_Trample = 0x802432b8;
Mario_SetAnimation = 0x80247670;
Mario_SetStatusToJumping = 0x802543a0;
Application_Init = 0x802a73c4;
EasyEmitParticle = 0x8000e3a4;
StartSoundActorWithInfo = 0x800185f4;
Camera_CalcFinalPosAndAt = 0x80023950;
Camera_UpdateGameCamera = 0x800234e8;
movePane = 0x8013eeb0;
PSMTXCopy = 0x803499bc;

1039
smsmulti.c Normal file

File diff suppressed because it is too large Load diff