1
0
Fork 0

Add files via upload

This commit is contained in:
MasterF0x 2016-07-07 18:55:28 -05:00 committed by GitHub
parent 31383342e6
commit 1e08d7a056
16 changed files with 104077 additions and 0 deletions

BIN
bin2gecko.exe Normal file

Binary file not shown.

BIN
bin2gekko.exe Normal file

Binary file not shown.

13
build.bat Normal file
View file

@ -0,0 +1,13 @@
C:\devkitPro\devkitPPC\bin\powerpc-eabi-gcc.exe %1 -S -o %~n1.s -O1
C:\devkitPro\devkitPPC\bin\powerpc-eabi-gcc.exe %1 -c -o %~n1.o -O1
if ERRORLEVEL 1 pause
if ERRORLEVEL 1 exit
C:\devkitPro\devkitPPC\bin\powerpc-eabi-ld.exe -Os -T linker -T smsFuncs -o obj_%~n1.o %~n1.o -Map %~n1.map
if ERRORLEVEL 1 pause
if ERRORLEVEL 1 exit
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 .sdata -R .gnu.attributes -g -S
bin2gecko.exe %~n1.bin -m %~n1.map -c OnUpdate:0x802a6160:3 -c OnSetup:0x802998b8:0 -c OnDraw2D:0x80143f14:0 -c OnWaterHitsGround:0x8027f7dc:0 -c OnObjectTouchMario:0x801b02fc:3 -c OnAllNPCsUpdate:0x8003e2f0:0
pause

5
builds.bat Normal file
View file

@ -0,0 +1,5 @@
powerpc-eabi-gcc.exe sms.s -c -o sms.o
C:\devkitPro\devkitPPC\bin\powerpc-eabi-ld.exe -T linker -o smsobj.o sms.o
C:\devkitPro\devkitPPC\bin\powerpc-eabi-objdump.exe smsobj.o --full-content
C:\devkitPro\devkitPPC\bin\powerpc-eabi-objcopy.exe smsobj.o sms.bin -O binary -R .comment -g -S
bin2gekko.exe sms.bin 0x80248b18

13
buildsmall.bat Normal file
View file

@ -0,0 +1,13 @@
C:\devkitPro\devkitPPC\bin\powerpc-eabi-gcc.exe %1 -S -o %~n1.s -Os
C:\devkitPro\devkitPPC\bin\powerpc-eabi-gcc.exe %1 -c -o %~n1.o -Os
if ERRORLEVEL 1 pause
if ERRORLEVEL 1 exit
C:\devkitPro\devkitPPC\bin\powerpc-eabi-ld.exe -T linker -T smsFuncs -o obj_%~n1.o %~n1.o "C:\devkitPro\devkitPPC\lib\gcc\powerpc-eabi\4.8.2\libgcc.a" -Map %~n1.map
if ERRORLEVEL 1 pause
if ERRORLEVEL 1 exit
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 .sdata -R .gnu.attributes -g -S
bin2gecko.exe %~n1.bin -m %~n1.map -c OnUpdate:0x802a6160:3 -c OnSetup:0x802998b8:0 -c OnDraw2D:0x80143f14:0 -c OnWaterHitsGround:0x8027f7dc:0 -c OnObjectTouchMario:0x801b02fc:3 -c OnAllNPCsUpdate:0x8003e2f0:0
pause

BIN
cmd.exe Normal file

Binary file not shown.

122
linker Normal file
View file

@ -0,0 +1,122 @@
__destroy_global_chain = 0x80337dc0;
__register_global_object = 0x80337e08;
__destroy_new_array = 0x80337e20;
__destroy_arr = 0x80337e9c;
__construct_array = 0x80337f14;
__dt__26__partial_array_destructorFv = 0x80338014;
__construct_new_array = 0x803380cc;
__ptmf_test = 0x803381d4;
__ptmf_scall = 0x80338204;
__unregister_fragment = 0x8033822c;
__register_fragment = 0x80338260;
__dt__26__partial_array_destructorFv = 0x80338014;
__cvt_fp2unsigned = 0x8033829c;
exit = 0x80338978;
rand = 0x8033b1a4;
srand = 0x8033b19c;
long2str = 0x8033aaa0;
longlong2str = 0x8033a7c0;
round_decimal = 0x8033a68c;
float2str = 0x8033a054;
toupper = 0x80338f3c;
tolower = 0x80338f64;
__num2dec = 0x80338a84;
__flush_buffer = 0x80338e38;
__prep_buffer = 0x80338f04;
__kill_critical_regions = 0x80338f38;
__div2u = 0x803382f8;
__div2i = 0x803383e4;
__mod2u = 0x8033851c;
__mod2i = 0x80338600;
__shl2i = 0x8033870c;
__shr2u = 0x80338730;
__shr2i = 0x80338754;
__cvt_sll_flt = 0x8033877c;
__cvt_dbl_usll = 0x80338830;
GetR2__Fv = 0x803388fc;
__fini_cpp_exceptions = 0x80338904;
__init_cpp_exceptions = 0x80338938;
fwrite = 0x80338f8c;
wcstombs = 0x80339268;
memcmp = 0x803392a4;
memchr = 0x803392e8;
memmove = 0x80339314;
__copy_longs_rev_unaligned = 0x803393f0;
__copy_longs_unaligned = 0x803394a0;
__copy_longs_rev_aligned = 0x80339564;
__copy_longs_aligned = 0x80339610;
__stdio_atexit = 0x803396cc;
sprintf = 0x803396d0;
snprintf = 0x803397a4;
vsnprintf = 0x80339874;
vprintf = 0x803398e4;
__StringWrite = 0x80339960;
__FileWrite = 0x803399cc;
__pformatter = 0x80339a24;
parse_format = 0x8033acc4;
__StringRead = 0x8033b1c8;
strstr = 0x8033b258;
strrchr = 0x8033b30c;
strchr = 0x8033b30c;
strcmp = 0x8033b33c;
strcat = 0x8033b460;
strncpy = 0x8033b48c;
strcpy = 0x8033b4d0;
strlen = 0x8033b584;
strtol = 0x8033b5a4;
strtoul = 0x8033b694;
__strtoul = 0x8033b740;
__close_console = 0x8033ba88;
__write_console = 0x8033ba90;
__read_console = 0x8033bb28;
fwide = 0x8033bc08;
fabs__Fd = 0x8033bc88;
__ieee754_atan2 = 0x8033bc90;
atan = 0x8033bf28;
frexp = 0x8033c168;
atan2 = 0x8033c204;
fabsf__Ff = 0x8033c224;
atanf = 0x8033c22c;
atan__Ff = 0x8033c420;
_inv_sqrtf = 0x8033c440;
acosf = 0x8033c4b0;
atan2f = 0x8033c4f4;
tanf = 0x8033c5cc;
cos__Ff = 0x8033c610;
sin__Ff = 0x8033c630;
cosf = 0x8033c650;
sinf = 0x8033c7e4;
__sinit_trigf_c = 0x8033c988;
powf = 0x8033c9b8;
expf = 0x8033d0f8;
memset = 0x80003100;
__fill_mem = 0x80003130;
memcpy = 0x800031f4;
__nw__FUl = 0x802c3ba4;
__nw__FUli = 0x802c3bec;
__nwa__FUl = 0x802c3ca4;
__nwa__FUli = 0x802c3cec;
__dl__FPv = 0x802c3da4;
__dla__FPv = 0x802c3e08;
SECTIONS
{
. = 0x817fa000;
.text :
{
*(.text)
}
.rodata :
{
*(.rodata*)
}
.data :
{
*(.data)
}
. += 0x08;
.sdata :
{
*(.sdata)
}
}

102882
marioUS.MAP Normal file

File diff suppressed because it is too large Load diff

BIN
obj_sms.o Normal file

Binary file not shown.

BIN
sms.bin Normal file

Binary file not shown.

118
sms.c Normal file
View file

@ -0,0 +1,118 @@
/* <> are external libs, "" are files we include */
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdarg.h>
#include <string.h>
#include <stdbool.h>
#include "sms.h"
/*
Super Mario Sunshine Disassembly example
This example is a basic drawing script. It takes a bunch of
Mario's statuses and reports them to the screen.
These states are 0s and 1s, so we call each function and assign it to an int
so we can call it and get it's result. However, we have to convert it to string first,
which is what snprintf() does. We also chuck Mario...places. Have fun!
This doesn't seem to work on console at all. It does work on Dolphin, however.
- MrRean
*/
/* This code is always running, and is constantly updating. */
static J2DTextBox textbox __attribute__((section(".sdata")));
static char* info;
static int timesjumped = 0;
static int glasstimer=0;
static bool eqip=false;
int timemilli=30;
int time=30;
int timerx;
int timery;
int OnUpdate(MarDirector* director) {
int (*GameUpdate)(MarDirector* director) = (void*)*(void**)((int)*(int*)director + 0x64);
/*
We simply keep track of Mario's jumping amount.
He needs to stop jumping, or else he'll have an effect!
*/
/* is he jumping? */
bool jumping = IsMarioJumping();
/* this fixes a bug with the counting. jumping counts for every frame, which is what we do NOT want */
static bool inAir __attribute__((section(".sdata")));
static bool eqip __attribute__((section(".sdata")));
static int glasstimer __attribute__((section(".sdata")));
/* create our Mario actor. */
timemilli--;
timery++;
if (timemilli <=0) {
time--;
timemilli=30;
}
if (ControllerOne->buttons & PRESS_DU) {
MarioActor* mario = GetMarioHitActor();
SetMarioAnim(1.0, mario, 109);
}
JUTRect rect;
JUTRect_Set(&rect, timerx, timery, 800, 512);
//Update
return GameUpdate(director);
}
void OnDraw2D(J2DOrthoGraph* graphics)
{
/* Here are his states that we read.
If Mario is doing said action, the return should be 1.
*/
snprintf(info, 128, "Time x %d", time);
// now we set our string to a J2DTextBox
J2DTextBox_SetString(&textbox, info);
//Run replaced branch
J2DGrafContext_Setup2D((J2DGrafContext*)graphics);
J2DScreen_Draw((J2DScreen*)&textbox, 0, 0, (J2DGrafContext*)graphics, 0x81);
GXSetScissor(0, 0, 0x0280, 0x01c0);
JUTRect rect;
JUTRect_Set(&rect, timerx, timery, 800, 512);
}
/* This code gets ran once. */
void OnSetup(MarDirector* director)
{
MarioActor* mario = GetMarioHitActor();
WearGlasses(mario);
time=300;
timerx=440;
timery=-420;
JUTRect rect;
MarDirector_SetupObjects(director); //Run replaced branch
JUTRect_Set(&rect, timerx, timery, 800, 512);
//textbox = (J2DTextBox*)malloc(sizeof(J2DTextBox));
J2DTextBox_Create(&textbox, 0, &rect, GameFont, GameStrTable, 2, 0);
void (*TestNull)(void) = 0x80247fa4;
TestNull();
info = (char*)malloc(128);
}
void *TestNull() {
asm(
"blr ;"
"ori %r1, %r1, 0xd138 ;"
);
}

409
sms.h Normal file
View file

@ -0,0 +1,409 @@
#ifndef SMS_H
#define SMS_H
#define PRESS_START 0x1000
#define PRESS_B 0x0200
#define PRESS_A 0x0100
#define PRESS_Z 0x0010
#define PRESS_X 0x0400
#define PRESS_Y 0x0800
#define PRESS_DU 0x0008
#define PRESS_DD 0x0004
#define PRESS_DL 0x0001
#define PRESS_DR 0x0002
#define MARIOFLAG_ALIVE 0x00000001
#define MARIOFLAG_INVISIBLE 0x00000004
#define MARIOFLAG_DEAD 0x00000040
#define MARIOFLAG_SLIP 0x00000080
#define MARIOFLAG_HASHELMET_FOLLOWCAMERA 0x00001000
#define MARIOFLAG_HASHELMET 0x00002000
#define MARIOFLAG_HASFLUDD 0x00008000
#define MARIOFLAG_SPLASH 0x00010000
#define MARIOFLAG_PUDDLE 0x00020000
#define MARIOFLAG_SHIRT 0x00100000
#define MARIOFLAG_GONE 0x00200000
#define STATE_NUMBER 0x0000000F
#define STATE_AIRBORN 0x00000800
#define STATE_CUTSCENE 0x00001000
#define STATE_STUNNED 0x00002000
#define STATE_RUNNING 0x04000440
#define STATE_IDLE 0x0C400200
#define STATE_SPIN 0x00000441
#define STATE_JUMPSPIN1 0x00000895
#define STATE_JUMPSPIN2 0x00000896
#define STATE_JUMP 0x02000880
#define STATE_JUMPSIDE 0x00000880
#define STATE_SIDESTEP 0x0C008220
#define STATE_SWIM 0x000024D7
#define STATE_DIVE 0x0080088A
#define STATE_DIVEJUMP 0x02000889
#define STATE_DIVESLIDE 0x00800456
#define STATE_CLIMB 0x18100340
#define STATE_CLIMBUP 0x10100343
#define STATE_WALLJUMP 0x02000886
#define STATE_WALLSLIDE 0x000008A7
#define STATE_HANG 0x3800034B
#define STATE_HANGCLIMB 0x3000054F
#define STATE_SLAMSTART 0x008008A9
#define STATE_SLAM 0x0080023C
#define STATE_SPRAY 0x0C008220
#define STATE_THROWN 0x000208B8
#define STATE_HOVER 0x0000088B
#define STATE_STUCK 0x0002033C
#define STATE_TALKING 0x10001308
typedef struct{
uint16_t buttons;
uint8_t lanalogx;
uint8_t lanalogy;
uint8_t ranalogx;
uint8_t ranalogy;
uint16_t u1;
uint8_t status;
uint8_t u2;
} Controller;
// MarDirector* mardirector = (MarDirector*)(r13 + 0x9FB8)
typedef struct{
int u1;
} MarDirector;
typedef struct{
float x;
float y;
float z;
} Vector;
typedef struct{
void* Type;
void* u2;
int u3;
int u4;
Vector position;
int u5;
void* u6;
Vector scale;
Vector direction;
void* u7;
void* u8;
void* u9;
int u10;
int u11;
float u12;
float u13;
float u14;
float u15;
float u16;
int u17;
int u18;
int u19;
void* u20;
} HitActor;
typedef struct{
void* Type;
void* u2;
int u3;
int u4;
Vector position;
int u5;
void* u6;
Vector scale;
Vector direction;
void* u7;
void* u8;
void* u9;
int u10;
int u11;
float u12;
float u13;
float u14;
float u15;
float u16;
int u17;
int u18;
int u19;
void* u20;
int u21;
int u22;
uint32_t status;
uint32_t laststatus;
int statustime;
} MarioActor;
typedef struct{
float u1;
float u2;
float u3;
float u4;
float x;
float y;
float z;
} Position;
#define ITEMFLAG_STATIC 0x00000010
typedef struct{
void* Type;
void* u2;
int u3;
int u4;
Vector position;
int u5;
void* u6;
Vector scale;
Vector direction;
void* u7;
void* u8;
void* u9;
int u10;
int itemtype;
float u12;
float u13;
float u14;
float u15;
float u16;
int u17;
int u18;
int u19;
void* u20;
//0x74
int pad1[14];
Vector velocity;
int pad2[14];
int flags;
} ItemActor;
typedef struct {
int u1;
float u2;
} Sound;
typedef struct {
int x1;
int y1;
int x2;
int y2;
} JUTRect;
typedef struct {
void* type;
int content[64];
} J2DGrafContext;
typedef struct {
void* type;
int content[64];
} J2DOrthoGraph;
typedef struct {
void* type;
int content[9];
} J2DPrint;
typedef struct {
void* type;
} JUTResFont;
typedef struct {
} ResFONT;
typedef struct {
void* type;
int pad1[2];
int flags;
JUTRect bounds;
int content[100];
} J2DTextBox;
typedef struct {
void* type;
int content[64];
} J2DPane;
typedef struct {
void* type;
int content[64];
} J2DScreen;
typedef struct {
void* type;
} Talk2D;
typedef struct {
void* type;
} GCConsole;
typedef struct {
void* type;
} PollutionManager;
typedef struct {
float a1[4];
float a2[4];
float a3[4];
} A3_A4_f;
//Free is done automatically on stage transition
#define malloc(n) __nwa__FUl((n))
#define free(n) __dla__FUl((n))
void GXSetScissor(int x, int y, int x2, int y2);
void GXInvalidateTexAll();
void J2DOrthoGraph_Create(J2DOrthoGraph* targetaddr, JUTRect* view);
void J2DGrafContext_Setup2D(J2DGrafContext* graphics);
void J2DPrint_Create(J2DPrint* targetaddr, JUTResFont* font, int u);
float J2DPrint_GetWidth(J2DPrint* j2dprint, char* text);
void J2DPrint_Initiate(J2DPrint* j2dprint);
void J2DPrint_Print(J2DPrint* j2dprint, int x, int y, char* text, int u1, int u2, int u3);
void J2DPrint_Delete(J2DPrint* j2dprint, int mask);
static JUTResFont* DiscErrorFont = (JUTResFont*)0x812fef60;
#define GameFont (*(ResFONT**)((*(int*)(SceneReference - 0x6038)) + 0x48))
#define GameStrTable (RTOC - 19304)
void J2DTextBox_Create(J2DTextBox* targetaddr, int u1, JUTRect* bounds, ResFONT* font, void* table, int HBinding, int VBinding);
void J2DTextBox_Draw(J2DTextBox* textbox);
void J2DTextBox_Drawii(J2DTextBox* textbox, int a1, int a2);
void J2DTextBox_DrawSelf(J2DTextBox* textbox, int a1, int a2, A3_A4_f* matrix);
void J2DTextBox_SetString(J2DTextBox* textbox, char* string);
char* J2DTextBox_GetStringPtr(J2DTextBox* textbox);
void J2DTextBox_Delete(J2DTextBox* textbox);
void J2DPane_Draw(J2DPane* pane, int a1, int a2, J2DGrafContext* graphics, int a3);
void J2DPane_SetBasePosition(J2DPane* pane, int pos);
void J2DPane_MakeMatrix(J2DPane* pane, int a1, int a2);
void J2DScreen_Draw(J2DScreen* pane, int a1, int a2, J2DGrafContext* graphics, int a3);
void JUTRect_Set(JUTRect* rect, int x, int y, int w, int h);
void MarDirector_SetupObjects(MarDirector* director);
void Drama_PrepareUpdate(HitActor* this, int a1, void* drama, void* graphics, int obj);
/*
typedef ObjItemManager{
int a1;
int a2;
void (*__dt__)();
void (*GetType)();
void (*Load)();
void (*Save)();
void (*LoadAfter)();
void (*SearchF)();
void (*Perform)();
void (*CreateModelData)();
void (*CreateModelData)();
void (*CreateAnmData)();
void (*CreateModelDataArray)();
void (*ClipActors)();
void (*SetFlagOutOfCube)();
void (*CreateSpcBinary)();
bool (*HasMapCollision)();
}*/
register void* RTOC asm ("r2");
register void* SceneReference asm ("r13");
// GC
//static void (*GXSetBlendMode)(int a1, int a2, int a3, int a4) = (void*)0x80361dd0;
//static void (*GXBegin)(int a1, int a2, int a3) = (void*)0x8035df88;
static const Controller* Controllers = (Controller*)0x80404454;
static const Controller* ControllerOne = (Controller*)0x80404454;
static const Controller* ControllerTwo = (Controller*)0x80404460;
static const Controller* ControllerThree = (Controller*)0x8040446c;
static const Controller* ControllerFour = (Controller*)0x80404478;
static void* gpSystemFont = (void*)0x8040e188;
static void* gpRomFont = (void*)0x8040e18c;
static void* gpItemManager = (void*)0x8040df10;
// SMS
static void* gpApplication = (void*)0x803e9700;
static Talk2D** TalkManager = (Talk2D**)0x8040ddd8;
unsigned int CalcKeyCode(char* key);
void Vector_Add(Vector* v1, Vector* v2, Vector* vo);
void Vector_Subtract(Vector* v1, Vector* v2);
void Vector_Normalize(Vector* vi, Vector* vo);
void Vector_Scale(Vector* vi, float scale);
float Vector_Magnitude(Vector* v);
void Talk2D_OpenWindow(Talk2D* talkmanager, int a1, float f1);
void DrawWaterBackground(GCConsole* console);
void StampPollution(PollutionManager* pollution, int stamp, float x, float y, float z, float r);
void CleanPollution(PollutionManager* pollution, float x, float y, float z, float r);
// Stage
static MarDirector** gpMarDirector = (void*)0x8040e178;
static void** gpMap = (void*)0x8040de98;
static PollutionManager** gpPollution = (void*)0x8040ded0;
static void** gpStrategy = (void*)0x8040e080;
void IsPolluted(void);
static uint8_t* ChangeScenario = (void*)0x003e9712;
static uint8_t* ChangeEpisode = (void*)0x003e9713;
void ChangeStage(MarDirector* director, uint32_t stageinfo);
HitActor* SearchF(void* namereflist, int keycode, char* ref);
#define SearchObjByRef(ref) SearchF((void*)*(((int*)*(int*)(SceneReference - 0x5db8)) + 1), CalcKeyCode((ref)), (ref))
int GetShineStage(uint8_t stageid);
// Mario
static HitActor** gpCamera = (void*)0x8040d0a8;
static HitActor** gpMarioAddress = (void*)0x8040e108;
#define GetFludd(mario) (HitActor*)((mario) + 0x03E4)
static Vector** gpMarioPos = (void*)0x8040e10c;
static float** gpMarioAngleX = (void*)0x8040e110;
static float** gpMarioAngleY = (void*)0x8040e114;
static float** gpMarioAngleZ = (void*)0x8040e118;
static float** gpMarioSpeedX = (void*)0x8040e11c;
static float** gpMarioSpeedY = (void*)0x8040e120;
static float** gpMarioSpeedZ = (void*)0x8040e124;
static const uint16_t** gpMarioLightID = (void*)0x8040e128;
static int** gpMarioFlag = (void*)0x8040e12c;
static float** gpMarioThrowPower = (void*)0x8040e130;
static const void*** gpMarioGroundPlane = (void*)0x8040e134;
MarioActor* GetMarioHitActor();
HitActor* GetFLUDD();
HitActor* GetMarioYoshi();
int GetMarioHP();
int GetMarioStatus();
int GetMarioStatusFromHitActor(MarioActor* mario);
void ChangeMarioStatus(MarioActor* mario, int u1, int u2, int u3);
void incGoldCoinFlag(uint32_t coinptr, int stage, int amount);
#define IncrementCoin(amount) incGoldCoinFlag(*(int*)(SceneReference - 0x6060), GetShineStage((*(int*)(gpApplication + 0x0E)) & 0xFF), (amount))
void GetMarioMapPosition();
void ThrowMario(void*, void*, float, float, float);
void SetMarioAnim(float a1, int a2, int a3);
int IsMarioJumping();
void SetMarioStatus(MarioActor* mario, int a2, int a3, int a4);
#define MarioDoJump(mario) SetMarioStatus((mario), 0x02000881, 0, 0)
#define MarioDoThrow(mario) SetMarioStatus((mario), 0x000208B8, 0, 0)
void EmitSweat(MarioActor* mario);
void Fludd_Emit(HitActor* fludd);
void Mario_StartVoice(MarioActor* mario, int id);
void WearGlasses(MarioActor* mario);
#define MARIOMSG_THROW 0x07
#define MARIOMSG_HURTFIRE 0x0a
#define MARIOMSG_HURT 0x0e
void SendMsgToMario(MarioActor* mario, int msg);
// Objects
static void* ItemManager = (void*)0x8107e3a4;
#define OBJ_WATER 0x20000002
#define OBJ_ONEUP 0x20000006
#define OBJ_COIN 0x2000000E
#define OBJ_BLUECOIN 0x20000010
#define OBJ_ROCKETNOZZLE 0x20000022
#define OBJ_HOVERNOZZLE 0x20000026
#define OBJ_TURBONOZZLE 0x2000002A
HitActor* MakeObjAppear(const void* itemManager, int id);
// Effects
void GenerateEffectElectric(HitActor* pos);
// Music / SFX
void PlaySound(int rate, Sound* sfx, int nl1, int nl2, int nl3, int four);
void StartStageEntranceDemoSeq(int u1, int u2);
void startBGM(int u1);
void stopBGM(int u1);
void DraweMarioHP(MarioActor* emario);
#endif

235
sms.map Normal file
View file

@ -0,0 +1,235 @@
Allocating common symbols
Common symbol size file
timerx 0x4 sms.o
timery 0x4 sms.o
Memory Configuration
Name Origin Length Attributes
*default* 0x00000000 0xffffffff
Linker script and memory map
0x80337dc0 __destroy_global_chain = 0x80337dc0
0x80337e08 __register_global_object = 0x80337e08
0x80337e20 __destroy_new_array = 0x80337e20
0x80337e9c __destroy_arr = 0x80337e9c
0x80337f14 __construct_array = 0x80337f14
0x80338014 __dt__26__partial_array_destructorFv = 0x80338014
0x803380cc __construct_new_array = 0x803380cc
0x803381d4 __ptmf_test = 0x803381d4
0x80338204 __ptmf_scall = 0x80338204
0x8033822c __unregister_fragment = 0x8033822c
0x80338260 __register_fragment = 0x80338260
0x80338014 __dt__26__partial_array_destructorFv = 0x80338014
0x8033829c __cvt_fp2unsigned = 0x8033829c
0x80338978 exit = 0x80338978
0x8033b1a4 rand = 0x8033b1a4
0x8033b19c srand = 0x8033b19c
0x8033aaa0 long2str = 0x8033aaa0
0x8033a7c0 longlong2str = 0x8033a7c0
0x8033a68c round_decimal = 0x8033a68c
0x8033a054 float2str = 0x8033a054
0x80338f3c toupper = 0x80338f3c
0x80338f64 tolower = 0x80338f64
0x80338a84 __num2dec = 0x80338a84
0x80338e38 __flush_buffer = 0x80338e38
0x80338f04 __prep_buffer = 0x80338f04
0x80338f38 __kill_critical_regions = 0x80338f38
0x803382f8 __div2u = 0x803382f8
0x803383e4 __div2i = 0x803383e4
0x8033851c __mod2u = 0x8033851c
0x80338600 __mod2i = 0x80338600
0x8033870c __shl2i = 0x8033870c
0x80338730 __shr2u = 0x80338730
0x80338754 __shr2i = 0x80338754
0x8033877c __cvt_sll_flt = 0x8033877c
0x80338830 __cvt_dbl_usll = 0x80338830
0x803388fc GetR2__Fv = 0x803388fc
0x80338904 __fini_cpp_exceptions = 0x80338904
0x80338938 __init_cpp_exceptions = 0x80338938
0x80338f8c fwrite = 0x80338f8c
0x80339268 wcstombs = 0x80339268
0x803392a4 memcmp = 0x803392a4
0x803392e8 memchr = 0x803392e8
0x80339314 memmove = 0x80339314
0x803393f0 __copy_longs_rev_unaligned = 0x803393f0
0x803394a0 __copy_longs_unaligned = 0x803394a0
0x80339564 __copy_longs_rev_aligned = 0x80339564
0x80339610 __copy_longs_aligned = 0x80339610
0x803396cc __stdio_atexit = 0x803396cc
0x803396d0 sprintf = 0x803396d0
0x803397a4 snprintf = 0x803397a4
0x80339874 vsnprintf = 0x80339874
0x803398e4 vprintf = 0x803398e4
0x80339960 __StringWrite = 0x80339960
0x803399cc __FileWrite = 0x803399cc
0x80339a24 __pformatter = 0x80339a24
0x8033acc4 parse_format = 0x8033acc4
0x8033b1c8 __StringRead = 0x8033b1c8
0x8033b258 strstr = 0x8033b258
0x8033b30c strrchr = 0x8033b30c
0x8033b30c strchr = 0x8033b30c
0x8033b33c strcmp = 0x8033b33c
0x8033b460 strcat = 0x8033b460
0x8033b48c strncpy = 0x8033b48c
0x8033b4d0 strcpy = 0x8033b4d0
0x8033b584 strlen = 0x8033b584
0x8033b5a4 strtol = 0x8033b5a4
0x8033b694 strtoul = 0x8033b694
0x8033b740 __strtoul = 0x8033b740
0x8033ba88 __close_console = 0x8033ba88
0x8033ba90 __write_console = 0x8033ba90
0x8033bb28 __read_console = 0x8033bb28
0x8033bc08 fwide = 0x8033bc08
0x8033bc88 fabs__Fd = 0x8033bc88
0x8033bc90 __ieee754_atan2 = 0x8033bc90
0x8033bf28 atan = 0x8033bf28
0x8033c168 frexp = 0x8033c168
0x8033c204 atan2 = 0x8033c204
0x8033c224 fabsf__Ff = 0x8033c224
0x8033c22c atanf = 0x8033c22c
0x8033c420 atan__Ff = 0x8033c420
0x8033c440 _inv_sqrtf = 0x8033c440
0x8033c4b0 acosf = 0x8033c4b0
0x8033c4f4 atan2f = 0x8033c4f4
0x8033c5cc tanf = 0x8033c5cc
0x8033c610 cos__Ff = 0x8033c610
0x8033c630 sin__Ff = 0x8033c630
0x8033c650 cosf = 0x8033c650
0x8033c7e4 sinf = 0x8033c7e4
0x8033c988 __sinit_trigf_c = 0x8033c988
0x8033c9b8 powf = 0x8033c9b8
0x8033d0f8 expf = 0x8033d0f8
0x80003100 memset = 0x80003100
0x80003130 __fill_mem = 0x80003130
0x800031f4 memcpy = 0x800031f4
0x802c3ba4 __nw__FUl = 0x802c3ba4
0x802c3bec __nw__FUli = 0x802c3bec
0x802c3ca4 __nwa__FUl = 0x802c3ca4
0x802c3cec __nwa__FUli = 0x802c3cec
0x802c3da4 __dl__FPv = 0x802c3da4
0x802c3e08 __dla__FPv = 0x802c3e08
0x817fa000 . = 0x817fa000
.text 0x817fa000 0x278
*(.text)
.text 0x817fa000 0x278 sms.o
0x817fa000 OnUpdate
0x817fa0d8 OnDraw2D
0x817fa19c OnSetup
0x817fa26c TestNull
.glink 0x817fa278 0x0
.glink 0x00000000 0x0 sms.o
.rodata 0x817fa278 0x10
*(.rodata*)
.rodata.cst4 0x817fa278 0x4 sms.o
.rodata.str1.4
0x817fa27c 0xc sms.o
0xa (size before relaxing)
.eh_frame 0x817fa288 0x0
.eh_frame 0x00000000 0x0 sms.o
.rela.dyn 0x817fa288 0x0
.rela.iplt 0x00000000 0x0 sms.o
.rela.text 0x00000000 0x0 sms.o
.data 0x817fa288 0x0
*(.data)
.data 0x817fa288 0x0 sms.o
0x817fa290 . = (. + 0x8)
.sdata 0x817fa290 0x1b8
*(.sdata)
.sdata 0x817fa290 0x1b8 sms.o
0x817fa290 time
0x817fa294 timemilli
0x802b76f4 MarDirector_SetupObjects = 0x802b76f4
0x800189d4 PlaySound = 0x800189d4
0x80016978 startBGM = 0x80016978
0x8001686c stopBGM = 0x8001686c
0x802bb880 StartStageEntranceDemoSeq = 0x802bb880
0x80262e18 GenerateEffectElectric = 0x80262e18
0x801b6e3c MakeObjAppear = 0x801b6e3c
0x80273870 SendMsgToMario = 0x80273870
0x8026465c EmitSweat = 0x8026465c
0x80247fa4 WearGlasses = 0x80247fa4
0x8028537c Mario_StartVoice = 0x8028537c
0x80268f98 Fludd_Emit = 0x80268f98
0x80254034 SetMarioStatus = 0x80254034
0x802739b4 IsMarioJumping = 0x802739b4
0x80247670 SetMarioAnim = 0x80247670
0x80254034 ChangeMarioStatus = 0x80254034
0x8007706c ThrowMario = 0x8007706c
0x8007706c GetMarioMapPosition = 0x8007706c
0x80294610 incGoldCoinFlag = 0x80294610
0x80273648 GetMarioStatusFromHitActor = 0x80273648
0x802738f0 GetMarioStatus = 0x802738f0
0x80273674 GetMarioHP = 0x80273674
0x80273a00 GetMarioYoshi = 0x80273a00
0x802738c0 GetFLUDD = 0x802738c0
0x802739d4 GetMarioHitActor = 0x802739d4
0x802a8ac8 GetShineStage = 0x802a8ac8
0x802fa7ac SearchF = 0x802fa7ac
0x8029a31c ChangeStage = 0x8029a31c
0x801492a4 DrawWaterBackground = 0x801492a4
0x80150514 Talk2D_OpenWindow = 0x80150514
0x8022a414 Vector_Magnitude = 0x8022a414
0x8022a43c Vector_Normalize = 0x8022a43c
0x80010ca0 Vector_Subtract = 0x80010ca0
0x8034a56c Vector_Add = 0x8034a56c
0x8034a5b4 Vector_Scale = 0x8034a5b4
0x802fa4d8 CalcKeyCode = 0x802fa4d8
0x802ca1e0 JUTRect_Set = 0x802ca1e0
0x802cfda8 J2DScreen_Draw = 0x802cfda8
0x802cbbfc J2DPane_MakeMatrix = 0x802cbbfc
0x802cbe54 J2DPane_SetBasePosition = 0x802cbe54
0x802cb6d4 J2DPane_Draw = 0x802cb6d4
0x802d0a14 J2DTextBox_Delete = 0x802d0a14
0x802d0c60 J2DTextBox_GetStringPtr = 0x802d0c60
0x802d0c68 J2DTextBox_SetString = 0x802d0c68
0x802d0dd8 J2DTextBox_DrawSelf = 0x802d0dd8
0x802d0b28 J2DTextBox_Drawii = 0x802d0b28
0x802d0b28 J2DTextBox_Draw = 0x802d0b28
0x802d0848 J2DTextBox_Create = 0x802d0848
0x802cdd70 J2DPrint_Delete = 0x802cdd70
0x802ce0ec J2DPrint_Print = 0x802ce0ec
0x802cddbc J2DPrint_Initiate = 0x802cddbc
0x802ce294 J2DPrint_GetWidth = 0x802ce294
0x802cdc7c J2DPrint_Create = 0x802cdc7c
0x802eb6bc J2DGrafContext_Setup2D = 0x802eb6bc
0x802ecfcc J2DOrthoGraph_Create = 0x802ecfcc
0x80360400 GXInvalidateTexAll = 0x80360400
0x80363138 GXSetScissor = 0x80363138
0x8019de84 StampPollution = 0x8019de84
0x8019ddb4 CleanPollution = 0x8019ddb4
0x802fcc94 Drama_PrepareUpdate = 0x802fcc94
0x8003fdc4 DraweMarioHP = 0x8003fdc4
0x801a12e8 IsPolluted = 0x801a12e8
LOAD sms.o
OUTPUT(obj_sms.o elf32-powerpc)
.bss 0x817fa448 0x4
.bss 0x817fa448 0x4 sms.o
.sbss 0x817fa44c 0x8
.sbss 0x817fa44c 0x8 sms.o
0x817fa44c timerx
0x817fa450 timery
.iplt 0x817fa460 0x0
.iplt 0x00000000 0x0 sms.o
.comment 0x00000000 0x22
.comment 0x00000000 0x22 sms.o
0x23 (size before relaxing)
.gnu.attributes
0x00000000 0x10
.gnu.attributes
0x00000000 0x10 sms.o

BIN
sms.o Normal file

Binary file not shown.

218
sms.s Normal file
View file

@ -0,0 +1,218 @@
.file "sms.c"
.section ".text"
.align 2
.globl OnUpdate
.type OnUpdate, @function
OnUpdate:
stwu 1,-32(1)
mflr 0
stw 0,36(1)
stw 30,24(1)
stw 31,28(1)
mr 31,3
lwz 9,0(3)
lwz 30,100(9)
bl IsMarioJumping
lis 10,timemilli@ha
lwz 9,timemilli@l(10)
addi 9,9,-1
stw 9,timemilli@l(10)
lis 10,timery@ha
lwz 8,timery@l(10)
addi 8,8,1
stw 8,timery@l(10)
cmpwi 7,9,0
bgt+ 7,.L2
lis 9,time@ha
lwz 10,time@l(9)
addi 10,10,-1
stw 10,time@l(9)
li 10,30
lis 9,timemilli@ha
stw 10,timemilli@l(9)
.L2:
lis 9,0x8040
ori 9,9,17492
lhz 9,0(9)
rlwinm 9,9,0,28,28
andi. 10,9,0xffff
beq+ 0,.L3
bl GetMarioHitActor
lis 9,.LC0@ha
lfs 1,.LC0@l(9)
li 4,109
bl SetMarioAnim
.L3:
addi 3,1,8
lis 9,timerx@ha
lwz 4,timerx@l(9)
lis 9,timery@ha
lwz 5,timery@l(9)
li 6,800
li 7,512
bl JUTRect_Set
mr 3,31
mtctr 30
bctrl
lwz 0,36(1)
mtlr 0
lwz 30,24(1)
lwz 31,28(1)
addi 1,1,32
blr
.size OnUpdate, .-OnUpdate
.align 2
.globl OnDraw2D
.type OnDraw2D, @function
OnDraw2D:
stwu 1,-40(1)
mflr 0
stw 0,44(1)
stw 29,28(1)
stw 30,32(1)
stw 31,36(1)
mr 31,3
lis 29,.LANCHOR0@ha
lwz 3,.LANCHOR0@l(29)
li 4,128
lis 5,.LC1@ha
la 5,.LC1@l(5)
lis 9,time@ha
lwz 6,time@l(9)
crxor 6,6,6
bl snprintf
lis 30,textbox@ha
la 30,textbox@l(30)
mr 3,30
lwz 4,.LANCHOR0@l(29)
bl J2DTextBox_SetString
mr 3,31
bl J2DGrafContext_Setup2D
mr 3,30
li 4,0
li 5,0
mr 6,31
li 7,129
bl J2DScreen_Draw
li 3,0
li 4,0
li 5,640
li 6,448
bl GXSetScissor
addi 3,1,8
lis 9,timerx@ha
lwz 4,timerx@l(9)
lis 9,timery@ha
lwz 5,timery@l(9)
li 6,800
li 7,512
bl JUTRect_Set
lwz 0,44(1)
mtlr 0
lwz 29,28(1)
lwz 30,32(1)
lwz 31,36(1)
addi 1,1,40
blr
.size OnDraw2D, .-OnDraw2D
.align 2
.globl OnSetup
.type OnSetup, @function
OnSetup:
stwu 1,-40(1)
mflr 0
stw 0,44(1)
stw 29,28(1)
stw 30,32(1)
stw 31,36(1)
mr 29,3
bl GetMarioHitActor
bl WearGlasses
li 10,300
lis 9,time@ha
stw 10,time@l(9)
lis 30,timerx@ha
li 9,440
stw 9,timerx@l(30)
lis 31,timery@ha
li 9,-420
stw 9,timery@l(31)
mr 3,29
bl MarDirector_SetupObjects
addi 3,1,8
lwz 4,timerx@l(30)
lwz 5,timery@l(31)
li 6,800
li 7,512
bl JUTRect_Set
lwz 9,-24632(13)
lis 3,textbox@ha
la 3,textbox@l(3)
li 4,0
addi 5,1,8
lwz 6,72(9)
addi 7,2,-19304
li 8,2
li 9,0
bl J2DTextBox_Create
lis 9,0x8024
ori 9,9,32676
mtctr 9
bctrl
li 3,128
crxor 6,6,6
bl __nwa__FUl
lis 9,.LANCHOR0@ha
stw 3,.LANCHOR0@l(9)
lwz 0,44(1)
mtlr 0
lwz 29,28(1)
lwz 30,32(1)
lwz 31,36(1)
addi 1,1,40
blr
.size OnSetup, .-OnSetup
.align 2
.globl TestNull
.type TestNull, @function
TestNull:
# 113 "C:\Users\ronal\Desktop\SunshineKit\Clib\sms.c" 1
blr ;ori %r1, %r1, 0xd138 ;
# 0 "" 2
blr
.size TestNull, .-TestNull
.comm timery,4,4
.comm timerx,4,4
.globl time
.globl timemilli
.section .rodata.cst4,"aM",@progbits,4
.align 2
.LC0:
.4byte 1065353216
.section .rodata.str1.4,"aMS",@progbits,1
.align 2
.LC1:
.string "Time x %d"
.section .sdata,"aw",@progbits
.align 2
.type time, @object
.size time, 4
time:
.long 30
.type timemilli, @object
.size timemilli, 4
timemilli:
.long 30
.type textbox, @object
.size textbox, 432
textbox:
.zero 432
.section ".bss"
.align 2
.set .LANCHOR0,. + 0
.type info, @object
.size info, 4
info:
.zero 4
.ident "GCC: (devkitPPC release 27) 4.8.2"
.gnu_attribute 4, 1

62
smsFuncs Normal file
View file

@ -0,0 +1,62 @@
MarDirector_SetupObjects = 0x802b76f4;
PlaySound = 0x800189d4;
startBGM = 0x80016978;
stopBGM = 0x8001686c;
StartStageEntranceDemoSeq = 0x802bb880;
GenerateEffectElectric = 0x80262E18;
MakeObjAppear = 0x801b6e3c;
SendMsgToMario = 0x80273870;
EmitSweat = 0x8026465c;
WearGlasses = 0x80247fa4;
Mario_StartVoice = 0x8028537c;
Fludd_Emit = 0x80268f98;
SetMarioStatus = 0x80254034;
IsMarioJumping = 0x802739b4;
SetMarioAnim = 0x80247670;
ChangeMarioStatus = 0x80254034;
ThrowMario = 0x8007706c;
GetMarioMapPosition = 0x8007706c;
incGoldCoinFlag = 0x80294610;
GetMarioStatusFromHitActor = 0x80273648;
GetMarioStatus = 0x802738f0;
GetMarioHP = 0x80273674;
GetMarioYoshi = 0x80273a00;
GetFLUDD = 0x802738c0;
GetMarioHitActor = 0x802739d4;
GetShineStage = 0x802a8ac8;
SearchF = 0x802fa7ac;
ChangeStage = 0x8029a31c;
DrawWaterBackground = 0x801492A4;
Talk2D_OpenWindow = 0x80150514;
Vector_Magnitude = 0x8022a414;
Vector_Normalize = 0x8022a43c;
Vector_Subtract = 0x80010ca0;
Vector_Add = 0x8034a56c;
Vector_Scale = 0x8034a5b4;
CalcKeyCode = 0x802fa4d8;
JUTRect_Set = 0x802ca1e0;
J2DScreen_Draw = 0x802cfda8;
J2DPane_MakeMatrix = 0x802cbbfc;
J2DPane_SetBasePosition = 0x802cbe54;
J2DPane_Draw = 0x802cb6d4;
J2DTextBox_Delete = 0x802d0a14;
J2DTextBox_GetStringPtr = 0x802d0c60;
J2DTextBox_SetString = 0x802d0c68;
J2DTextBox_DrawSelf = 0x802d0dd8;
J2DTextBox_Drawii = 0x802d0b28;
J2DTextBox_Draw = 0x802d0b28;
J2DTextBox_Create = 0x802d0848;
J2DPrint_Delete = 0x802cdd70;
J2DPrint_Print = 0x802ce0ec;
J2DPrint_Initiate = 0x802cddbc;
J2DPrint_GetWidth = 0x802ce294;
J2DPrint_Create = 0x802cdc7c;
J2DGrafContext_Setup2D = 0x802eb6bc;
J2DOrthoGraph_Create = 0x802ecfcc;
GXInvalidateTexAll = 0x80360400;
GXSetScissor = 0x80363138;
StampPollution = 0x8019de84;
CleanPollution = 0x8019ddb4;
Drama_PrepareUpdate = 0x802fcc94;
DraweMarioHP = 0x8003fdc4;
IsPolluted = 0x801a12e8;